Level 3 — Component — HubSpot adapter
Level 3 — Component — HubSpot adapter
Diagram type: Component Scope: the functions and libraries inside the HubSpot adapter Function App. Audience: the developers building and operating the adapter. Structurizr view:
Components-HubSpotAdapterin structurizr/workspace.dsl
Overview
The HubSpot adapter is the most complex container because it implements both ingestion paths for one source: the polling path that guarantees completeness (incremental and historical extractors, reconciliation counter) and the push path that only accelerates (webhook receiver, nudge worker). All HubSpot calls go through one client that acquires tokens from one rate limiter, so the per-10-second and daily limits are enforced in a single place regardless of which function is calling. Every data output is a landing file in OneLake with a manifest; the adapter never writes Delta tables. Its own run state (page cursors, webhook receipts, requests used) goes to the adapter state store in Table Storage through one state client.
Diagram
C4Component
title Component diagram for the HubSpot adapter (Azure Functions, .NET 10)
System_Ext(hs, "HubSpot", "CRM v3 API; webhook sender")
Container(orch, "Orchestrator", "Fabric pipelines", "Invokes operations with a window")
Container(recon, "Reconciler", "Fabric notebook", "Requests counts")
ContainerQueue(sb, "Service Bus", "Azure Service Bus", "ingest-nudges queue")
ContainerDb(bronze, "lh_bronze", "Fabric Lakehouse", "Landing folder")
ContainerDb(state, "Adapter state store", "Azure Table Storage", "Cursors, receipts, requests used")
Container(kv, "Key Vault", "Azure Key Vault", "Token and webhook secret")
Container_Boundary(fnhs, "HubSpot adapter") {
Component(receiver, "Webhook receiver", "HTTP-triggered function", "Validates v3 signature and timestamp; acknowledges in ms; enqueues ids")
Component(nudge, "Nudge worker", "Queue-triggered function", "Batch-reads nudged ids; lands records with op=webhook_nudge")
Component(extractor, "Incremental extractor", "HTTP-triggered function", "Search by hs_lastmodifieddate window; keyset pages on hs_object_id, 200 per page; count for reconciliation; manifest")
Component(historical, "Historical extractor", "HTTP-triggered function", "Pages list endpoints or async export for the initial load")
Component(counter, "Reconciliation counter", "HTTP-triggered function", "Source counts per object and day")
Component(client, "HubSpot API client", ".NET library, HttpClient", "Typed CRM v3 calls; pinned API version")
Component(limiter, "Rate limiter", ".NET library", "Paced per-caller limiter: at most the share in any rolling window, per 10 s, search per second, associations; daily ledger; honours Retry-After")
Component(landing, "Landing writer", ".NET library, DataLake SDK", "JSONL pages and manifest.json to OneLake")
Component(stateclient, "State client", ".NET library, Azure.Data.Tables", "Page cursors, webhook receipts, requests used")
Component(secrets, "Secret provider", ".NET library, Azure.Identity", "Token and webhook secret from Key Vault")
}
Rel(hs, receiver, "Sends webhooks to", "HTTPS, signed JSON")
Rel(receiver, secrets, "Gets the webhook client secret from")
Rel(receiver, sb, "Enqueues object ids on", "AMQP")
Rel(receiver, stateclient, "Logs webhook receipts through")
Rel(sb, nudge, "Delivers batches of nudged ids to", "AMQP")
Rel(nudge, client, "Batch-reads current records through")
Rel(nudge, landing, "Lands nudged records through")
Rel(orch, extractor, "Invokes with object, window, cursor", "HTTPS, JSON")
Rel(orch, historical, "Invokes with object and partition", "HTTPS, JSON")
Rel(recon, counter, "Requests counts per object and day from", "HTTPS, JSON")
Rel(extractor, client, "Searches and batch-reads through")
Rel(historical, client, "Pages list endpoints through")
Rel(counter, client, "Runs count searches through")
Rel(client, limiter, "Acquires request tokens from")
Rel(client, secrets, "Gets the private-app token from")
Rel(client, hs, "Calls objects, search, batch read and events endpoints on", "CRM v3 API, HTTPS")
Rel(extractor, landing, "Writes pages and manifest through")
Rel(historical, landing, "Writes pages and manifest through")
Rel(extractor, stateclient, "Commits page cursors and requests used through")
Rel(historical, stateclient, "Commits page cursors and requests used through")
Rel(landing, bronze, "Writes JSONL files and manifest.json to the landing folder of", "OneLake ADLS Gen2 API")
Rel(stateclient, state, "Writes cursors, receipts and request counts to", "Table Storage, managed identity")
Rel(secrets, kv, "Reads secrets from", "managed identity")
Legend
- Component: a function or a class library inside the Function App; not separately deployable.
- Container (outside the boundary): neighbours the components talk to.
- Functions are named by trigger type in the technology column; libraries are shared in-process.
Elements
| Element | Type | Technology | Responsibility |
|---|---|---|---|
| Webhook receiver | Component | HTTP-triggered function | Validate X-HubSpot-Signature-v3 and timestamp; return
200 fast; enqueue
{object, objectId, occurredAt, subscriptionType, portalId}
(mapped through webhook_object_type; unmapped events
dropped and counted); log the receipt |
| Nudge worker | Component | Service Bus queue-triggered function | Batch-read up to 100 ids; land with
op=webhook_nudge |
| Incremental extractor | Component | HTTP-triggered function | Keyset paging on hs_object_id inside the
hs_lastmodifieddate window (one sort rule, 200 per page, no
offset); count per window for reconciliation; batch-read; manifest;
commit the cursor (last id) after each page |
| Historical extractor | Component | HTTP-triggered function | List endpoints (100 per page) or async export; partition by object and id range |
| Reconciliation counter | Component | HTTP-triggered function | Search total per object per source-modified-day |
| HubSpot API client | Component | .NET class library, HttpClient |
Typed calls; API version pinned; archived=true
sweeps |
| Rate limiter | Component | .NET class library | Paced per-caller limiter: at most the share in any rolling window of
the per-app 10-second budget, the per-account search rate and the
associations rate; injectable clock; daily ledger with reserve;
Retry-After; requests-used counter |
| Landing writer | Component | .NET class library, Azure.Storage.Files.DataLake |
Files/landing/hubspot/{object}/{yyyy}/{MM}/{dd}/{run_id}/page-NNNNN.jsonl
and manifest.json |
| State client | Component | .NET class library, Azure.Data.Tables |
Page cursors, webhook receipts and requests used in the adapter state store; the only writable state the adapter has |
| Secret provider | Component | .NET class library, Azure.Identity |
Private-app token and webhook secret from Key Vault with the managed identity; cached with expiry |
Key relationships
| From | To | Intent | Protocol / Technology |
|---|---|---|---|
| HubSpot | Webhook receiver | Sends webhooks | HTTPS, signed JSON |
| Webhook receiver | Service Bus | Enqueues ids | AMQP |
| Service Bus | Nudge worker | Delivers id batches | AMQP |
| Orchestrator | Incremental and historical extractors | Invokes with window or partition | HTTPS, JSON |
| Reconciler | Reconciliation counter | Requests counts | HTTPS, JSON |
| All functions | HubSpot API client | Typed calls | In-process |
| HubSpot API client | Rate limiter | Acquires tokens | In-process |
| HubSpot API client | HubSpot | CRM v3 calls | HTTPS, JSON |
| Extractors, nudge worker | Landing writer | Write pages and manifest | In-process |
| Extractors, receiver | State client | Cursors, receipts, requests used | In-process |
| Landing writer | lh_bronze | Writes landing files | OneLake ADLS Gen2 API |
| State client | Adapter state store | Writes state | Table Storage, managed identity |
| Secret provider | Key Vault | Reads secrets | Managed identity |
Notable architectural decisions
- Webhooks are acknowledged before any HubSpot call is made, so HubSpot never retries because of our latency; the record is fetched asynchronously by the nudge worker (ADR 3).
- HubSpot limits are per app and per account, not per endpoint (ADR 10); because several functions draw on them concurrently, each function's client carries a limiter sized to that function's static share and runs as one in-flight instance (ADR 8, PoC brief).
- The adapter writes files, not Delta, so the Bronze loader (a Fabric notebook) owns Delta semantics and the adapter has no Spark dependency; its run state goes to Table Storage, which a Function can write, and is mirrored into the control schema (ADR 8).
Assumptions
- HubSpot's search endpoints are limited to 5 requests per second per account, outside the per-app limit; the limiter keeps a separate bucket for search and another for the associations API (150 per 10 s on Professional/Enterprise).
- Long historical runs use the async start, poll, complete pattern through the orchestrator's Web activity; the component boundary is unchanged.