Queue-Based Processing
When your app receives a webhook notification, it should not process the data synchronization inline. Instead, the proven approach is to add a work item to a queue and process it asynchronously. This page explains why queues matter and how to think about them.
Why Use a Queue?
Webhook Timeouts
VARIO ERP expects a fast response (HTTP 200) from your webhook endpoint. If your handler takes too long β because it's calling the platform API, transforming data, or retrying failed requests β the webhook delivery will time out and may be retried, creating duplicate work.
Burst Protection
A bulk update in the ERP (e.g., a price adjustment across 500 articles) fires 500 individual webhooks in rapid succession. Without a queue, your app would attempt 500 simultaneous API calls to the external platform, likely hitting rate limits.
Retry and Error Recovery
When a sync operation fails (network error, platform downtime, rate limit), a queue gives you a natural place to track the failure and retry later β without losing the work item.
Deduplication
If the same article is updated multiple times within a short window, a queue lets you collapse those changes into a single sync operation.
Queue Concepts
A queue for shop integration typically tracks these properties for each work item:
Topic
What type of sync operation to perform (e.g., article sync, stock sync, price sync)
Entity ID
Which entity to process (e.g., the article ID)
State
Current processing state
Sales Channel
Which sales channel this work item belongs to
Attempt Count
How many times processing has been attempted
Last Error
Error details from the most recent failed attempt
Timestamps
When the item was created and last processed
Work Item States
A work item moves through these states:
QUEUED β Waiting to be picked up by the queue processor
PROCESSING β Currently being processed
COMPLETED β Successfully synced to the platform
FAILED β Processing failed; the error is recorded for debugging or retry
Processing Pattern
A queue processor typically follows this loop:
Fetch a batch of items in
QUEUEDstate (limit the batch size to control load)Mark each item as
PROCESSINGFor each item, execute the appropriate sync operation
On success, mark as
COMPLETEDOn failure, record the error and mark as
FAILEDRepeat until the queue is empty
Batch Size
Control how many items are processed in each cycle. A smaller batch size (e.g., 10) is safer when the external platform has strict rate limits. A larger batch size (e.g., 50β100) improves throughput when rate limits are generous.
Triggering the Processor
You can trigger queue processing in several ways:
On webhook arrival β After adding an item to the queue, immediately start processing
On a timer β Run the processor at regular intervals (e.g., every 30 seconds)
On demand β Provide a UI button or API endpoint for manual processing
Deduplication
When a webhook fires for an entity that is already in the queue (state QUEUED or PROCESSING), you have two options:
Skip β Don't add a duplicate entry. The existing item will pick up the latest data when it processes.
Replace β Update the existing item's timestamp so it's processed with the latest data.
Skipping is usually sufficient, because the sync operation fetches the current state of the entity from the ERP at processing time β not at queuing time.
Error Handling in the Queue
When a sync operation fails:
Record the error β Store the error message and any relevant details (HTTP status code, platform error response) on the work item
Increment the attempt count β Track how many times this item has failed
Set state to FAILED β Make it visible in the UI for debugging
For retry strategies, see Error Handling.
Topics
Each queue item has a topic that determines which sync handler processes it. Common topics for shop integrations:
article.sync
Push article master data to platform
stock.sync
Update inventory levels on platform
price.sync
Update product prices on platform
order-status.sync
Send fulfillment updates to platform
media.sync
Upload product images to platform
Relationship to Transfer Toggles
Before processing a queue item, check whether the corresponding transfer toggle is enabled. If the user has disabled stock sync for a particular sales channel, items with the stock.sync topic should be skipped or ignored.
Last updated
Was this helpful?