githubEdit

Eventing

circle-exclamation

Eventing is the mechanism that notifies external systems about business events, such as Order has been routed or pick job has been completed. Events are phrased in the past tense because they describe actions that have already occurred.

Eventing is available for a callback URL, the Microsoft Azure Service Busarrow-up-right, and Google Cloud Pub/Subarrow-up-right.

Drawing

Timing

Events are the primary mechanism for decoupling services within a distributed system. The time from publication on the message bus to delivery to a subscription is typically a few milliseconds to several seconds. In worst-case scenarios, such as when backend services are scaling up, this process can take up to 30 seconds.

The following diagram shows the typical timing of events originating from fulfillmenttools to an external system:

Drawing
Typical time of event distribution

triangle-exclamation

Receiving events

For all Available events, subscriptions can be created using the eventing API to receive notifications.

circle-check

Prerequisites

circle-exclamation

Limitations

In the below example, we set up a subscription for the order created event.

1

Set up your preferred provider

Use the tabs below to select the relevant provider instructions needed for set up

Visit webhook.sitearrow-up-right to generate a unique URL that can be used for testing and allows the response code to be changed to simulate failing requests.

The following values are then used for the subscription API call in fulfillmenttools:

GET url corresponds to callbackURL.

2

Access the endpoint

circle-info

In the Postman collection, you can select the relevant provider for this endpoint.

3

Register the event

Update the parameters in the body for the relevant settings you created in step one for your provider.

A successful request returns a 201 Created status, and the subscription becomes active immediately.

4

Test the notification

Create a new test order with the follow endpoint to trigger the ORDER_CREATED event:

A successful request returns a 201 Created status, and you should receive a notification on your provider service of the order.

Contexts

For the INVENTORY_FACILITY_STOCK_CHANGED event, it's possible to specify contexts to further restrict when a subscription is triggered.

  • If contexts are specified, the subscription is triggered only if all contexts apply.

  • Available context types are FACILITY and FACILITY_GROUP.

  • An event applies if it occurs for a:

    • Facility explicitly listed in the context

    • Facility that belongs to one of the specified facility groups

  • If the event is a bulk event containing multiple payloads, the payloads are filtered to include only those relevant to the specified contexts.

Attempts to resend messages that weren't delivered successfully

fulfillmenttools follows the exponential backoff pattern when a configured subscription is unreachable or returns a response code other than 200 OK. If this happens, fulfillmenttools will automatically initiate a retry. The time between the retries will progressively increase with every retry from 20 seconds until it reaches 600 seconds. This is executed for one hour.

Redelivery attempts continue at this maximum interval until one of the following occurs:

  • The subscription endpoint acknowledges the event by returning a 200 OK response.

  • The event's 7-day retention period has expired, at which point it's permanently dropped and deleted.

circle-info

fulfillmenttools can't guarantee how many times or the interval between retries after one hour.

See the following diagram that visualizes the approach:

Drawing
Diagram of an exponential backoff pattern for retrying messages, starting with a 20-second delay and increasing to a maximum of 600 seconds.

circle-exclamation

circle-info

Monitoring and alerting

It's recommended to monitor the subscription endpoint and employ an alerting mechanism to detect failures early, preventing events from being dropped after the retention period expires.

Event flow examples

fulfillmenttools communicates relevant changes through events. The flowcharts below provide a brief overview of a subset of processes and the events they trigger.

A comprehensive overview of all events is available in the Available events article.

circle-info

The flows below are examples of a standard, successful process in fulfillmenttools. The exact sequence of flows and events can differ depending on the specific configuration of modules and processes.

circle-exclamation

Order, reservations, and fulfillment

The following diagram depicts the typical events emitted during an exemplary order fulfillment process. This includes order routing, reservations, picking, packing, and handover, as well as a potential return.

Flowchart of the order fulfillment process, showing events from order creation and routing through picking, packing, handover, and a potential return.

Inbound process

The following diagram depicts the typical events emitted during an exemplary inbound process, from the creation of a Purchase Order (PO) to the receipt of goods.

Flowchart of the inbound process, showing events from the creation of a purchase order to the receipt of goods.

Stow jobs

The following diagram depicts the typical events emitted during an exemplary stowing process, from the creation of a stowJob to the stowing of the final items and the completion of the job.

Flowchart of the stow job process, showing events from the creation of the stow job to its completion.

Last updated