Fluent Commerce Logo
Docs

Frameworks

User Interface Framework (WebApps, Manifest Configuration, Fragments, Components, and their Elements.), Orchestration Framework (Workflow, Actions, Rules, Entities, Contracts, Settings, Triggers, Status, and Variables), Developer Tooling (Modules, Templates, Connectors, and SDKs.)

External Webhook Integration Architecture - commercetools Connector

Essential knowledge
Explains how the commercetools Connector ingests inbound webhooks and dispatches outbound payloads across the integration ecosystem. Partners will learn to configure and apply this shared framework utility, which manages message routing, handler resolution, and internal queue mechanics. For the business, this asynchronous architecture ensures real-time, secure data transmission and protects platform stability by preventing message loss during high-volume storefront traffic spikes.Note: This architectural component serves as a global framework utility rather than a single functional pipeline.
  • Core Function & Outcome: You will learn how the framework utility orchestrates bidirectional ingress and egress loops, serving as the master execution blueprint for all entity-specific data synchronization pipelines.
  • Asynchronous Queue Infrastructure: The architecture processes incoming webhook payloads through an external `ct-queue` and an internal Event Queue sequentially, decoupling network reception tasks from backend data processing to maintain platform throughput.
  • Declarative Route Filtering: Implementing partners can manage message names, configure explicit inclusion filters, and reassign target event pathways directly inside the `application-connector.yml` configuration file.
  • Extensible Handler Architecture: The core message routing and processing layers are completely decoupled, allowing developers to cleanly register custom storefront event handlers by extending the base `MessageHandler` class.

Fetching Data with the useQuery Hook

Essential knowledge
This lesson focuses on fetching data within a custom form field using the `useQuery` hook. We'll move away from relying on page query data and instead directly query the Fluent GraphQL API to retrieve a list of nearby locations with product stock. This involves defining data structures for query results, storing the query in a constant, and using the `useQuery` hook to execute the query with dynamic parameters derived from the form's context and the user's context (via `useAuth`). We will then render the results in a selectable list using radio buttons.
  • Data Independence: Components should fetch their own data using the `useQuery` hook, rather than relying on potentially unavailable page query data.
  • GraphQL Query: A GraphQL query (`searchVirtualInventory`) is used to retrieve nearby locations with stock.
  • Data Structures: Interfaces (SVINode, SVIResult) are defined to structure the query results.
  • `useQuery` Hook: The `useQuery` hook is used to execute the GraphQL query with dynamic parameters.
  • Dynamic Parameters: Query parameters (`productRef`, `locationRef`, `lat`, `lng`) are derived from the form's entity context (product) and the user's context (location) using the `useAuth` hook.
  • Loading State: A loading state is implemented while the query progresses.
  • Result Rendering: The query results are initially logged to the console and then rendered as a list of selectable locations using radio buttons.
  • User Selection: A state variable and event handler are used to track the user's selected location.