Webhooks and the event catalogue
The only push surface Karyo has: how the relay works, what a receiver gets, what it can rely on, and every event type it can receive. Events and the outbox owns the outbox's internals and the synchronous CDI events beside it; this document is the contract as a subscriber sees it.
1. The shape of the relay
services/integration-hub-service/ holds two modules: karyo-webhooks-api (the envelope and two
SPIs) and karyo-webhooks-core (everything else). It is core code.
Its build-file comment names it "Integration hub modules (webhooks; future: import/export, ERP
adapters)" (settings.gradle.kts, include of karyo-webhooks-api and karyo-webhooks-core (integration-hub comment)), so webhooks are the whole hub.
The relay reads the transactional outbox
(ADR 0009) with two schedulers, both
@Scheduled(every = "{karyo.webhooks.poll-interval}") with ConcurrentExecution.SKIP:
Fan-out (WebhookFanoutScheduler.runOnce) reads outbox rows by id after a persistent cursor,
takes every active = true subscription across all tenants, and for each (event, subscription)
pair inserts a webhook_delivery row when four tests pass: the event reaches the subscription's
audience (a Facility event names the subscription's Facility; a master-data event, with no
facility_id, names the Business Unit that owns the subscription's Facility, derived through
OrganizationLookup; a subscription stores no Business Unit of its own); the subscription's
patterns match the event type; the Facility is active or the event was created at or before its
archive; and no delivery already exists for that pair. A subscription's audience is therefore one
Facility
(ADR 0045). It then
advances the cursor to the highest id it saw, whether or not anything matched.
The cursor is a dedicated single-row table, webhook_fanout_cursor
(V901__create_webhooks.sql, webhook_subscription, webhook_delivery, webhook_fanout_cursor), with a CHECK (id = 1) singleton constraint. OutboxReader's
KDoc states the reason explicitly: OutboxEvent.published is not a delivery checkpoint, so fan-out
progress belongs to its own cursor (the OutboxReader KDoc in WebhookFanoutScheduler.kt).
Delivery (WebhookDeliveryScheduler) fetches the ids of due deliveries
(PENDING/FAILED with nextAttemptAt <= now, oldest id first, batchSize at a time) and hands
each to WebhookDeliveryProcessor.deliverOne, which runs @Transactional(REQUIRES_NEW). The class
KDocs record why each delivery gets its own transaction: in a single shared transaction, one slow
partner could trigger a JTA timeout that rolled back deliveries that had already succeeded in the
same tick, producing a cross-tenant re-fire storm (WebhookDeliveryScheduler,
WebhookDeliveryProcessor).
2. What arrives at the receiver
A JSON POST with five headers (WebhookDeliveryProcessor.deliverOne):
| Header | Value |
|---|---|
Content-Type |
application/json |
X-Karyo-Event |
the event type |
X-Karyo-Delivery |
the numeric delivery-row id, as a string, stable across retries |
X-Karyo-Timestamp |
Unix epoch seconds, regenerated per attempt |
X-Karyo-Signature |
sha256= + lowercase hex HMAC-SHA256 over "{timestamp}.{body}" |
The body is a WebhookEnvelope (WebhookEnvelope, built at
WebhookEnvelopeBuilder):
{
"schemaVersion": "number - 2; there is no version 1",
"eventId": "string - deterministic UUID for this delivery row, stable across retries",
"eventType": "string - e.g. 'item-data.created'",
"occurredAt": "string - ISO-8601 UTC, the outbox row's creation time",
"scopeType": "string - 'FACILITY' for an operational event, 'BUSINESS_UNIT' for a master-data event",
"facilityId": "number or null - the Facility the event happened in; null for a master-data event",
"businessUnitId":"number - the Business Unit that owns the event (for a Facility event, the owner of that Facility)",
"companyCode": "string - the installation's Company code",
"aggregateType": "string - the aggregate, e.g. 'ItemData'",
"aggregateId": "number - database id of the aggregate (0 for User events)",
"data": "object - the event's payload, see the catalogue in section 8"
}
data is the outbox row's stored JSON payload, re-parsed.
eventId is not the source event's identity. It is
UUID.nameUUIDFromBytes("delivery-${d.id}") - a deterministic UUID derived from the delivery-row id
(WebhookDeliveryProcessor.envelopeFor). That makes it stable across retries of one delivery, which is
what a receiver needs for idempotency. The consequence is that the outbox event id is never on the
wire in any form: two subscriptions receiving the same domain event see two different eventId
values and two different X-Karyo-Delivery values, with nothing in common to correlate them by. Why
the source event's identity is left out of the envelope is not recorded.
3. Signing and its limits
HmacSha256Signer computes "sha256=" + hex(HMAC-SHA256(secret, "$timestamp.$body")).
The signing input is the timestamp header, a literal period, and the raw request body:
signingInput = "{X-Karyo-Timestamp}.{rawBody}"
expected = "sha256=" + hex(HMAC-SHA256(subscriptionSecret, signingInput))
A receiver verifies it like this, and must compare in constant time:
import hmac, hashlib
def verify(secret: str, timestamp: str, raw_body: bytes, header_sig: str) -> bool:
signing_input = f"{timestamp}.".encode() + raw_body
mac = hmac.new(secret.encode(), signing_input, hashlib.sha256)
computed = "sha256=" + mac.hexdigest()
return hmac.compare_digest(computed, header_sig)
The secret is 32 random bytes from SecureRandom, hex-encoded to 64 characters
(WebhookSubscriptionService.newSecret), and the HMAC key is that 64-character string. It is
returned once by create and once after each rotation. To rotate or recover a lost secret, call
POST /api/v1/webhook-subscriptions/{id}/rotate-secret. The response is 200 with
{"secret":"<new 64-character secret>"} and Cache-Control: no-store.
List, get and update never return the secret. Rotation keeps the subscription, its patterns,
its active state and its delivery history.
There is no overlap window. Once rotation commits, attempts that load the subscription use only the new secret, including pending deliveries, retries and manual redeliveries. The old secret no longer signs new attempts. An already-running attempt may have loaded the old secret before rotation committed; rotation cannot recall that request. Coordinate the receiver's change with rotation and allow for in-flight requests.
Nothing enforces a timestamp freshness window on the receiver's behalf and nothing versions the signature scheme; a receiver must impose its own replay window.
Targets require https by default. Create or update with an http target returns 400 with the
problem slug webhook-https-required. For test receivers only, an operator can enable the catalogue
setting karyo.webhooks.allow-http (default false, environment KARYO_WEBHOOKS_ALLOW_HTTP).
It resolves for the subscription's Facility through the runtime configuration ladder and is not
writable by a goods-owner administrator. This exception does not bypass the SSRF guard.
The relay checks this setting before each attempt too: disabling it prevents sending to previously
stored http targets. Such attempts fail and consume the normal retry budget without sending.
4. Delivery guarantees, stated plainly
- At-least-once, while the subscription is active. The unique index
uq_webhook_delivery_event (subscription_id, outbox_event_id) WHERE outbox_event_id IS NOT NULL(V901__create_webhooks.sql,webhook_subscription, webhook_delivery, webhook_fanout_cursor) plus theexistsForEventpre-check make fan-out idempotent, so a re-scan cannot double-enqueue. Delivery itself retries, so a receiver must deduplicate oneventIdorX-Karyo-Delivery. - Events published while a subscription is inactive are lost permanently. Fan-out reads
subs.findActive()(WebhookSubscriptionRepository) and the cursor advances regardless, so deactivating a subscription is not a pause - it is a drop.activeis an ordinary editable boolean with no warning, and reads naturally as a pause. The same applies to a subscription created later: it starts at the current cursor, never at the beginning. - No ordering guarantee. Within one fan-out batch, delivery ids follow outbox ids, and
findDueorders by id ascending (WebhookDeliveryRepository). But a delivery that fails is rescheduled bynextAttemptAtand rejoins the queue behind newer ones, so a receiver can seepick-order.pickedbefore thepick-order.createdit retried past - up to an hour later on the last attempts. - Single-instance by assumption. Neither scheduler locks rows (
findDueis a plain query, noSELECT ... FOR UPDATE).ConcurrentExecution.SKIPguards a tick against its own predecessor within one JVM and nothing else, so a second application instance would double-deliver. Karyo runs one instance by design (ADR 0022). - Retry budget. Eight attempts by default, set per installation with
KARYO_WEBHOOKS_MAX_ATTEMPTS(the back-off base and cap areKARYO_WEBHOOKS_BACKOFF_BASEandKARYO_WEBHOOKS_BACKOFF_CAP); back-offbase x 2^(attempts-1)seconds with a 10-second base, capped at one hour, with the shift clamped to 30 (ExponentialBackoffRetryPolicy, defaults atapplication.yaml,karyo.webhooks). After the last attempt the row becomesDEAD, and the console's Integrations page lists it (frontend/web/src/pages/admin/admin-integrations-page.tsx,DetailPanel).POST /api/v1/webhook-deliveries/{id}/redeliverresetsattemptsto 0, granting a full fresh budget (WebhookDeliveryService). - Fan-out does not deliver Company-level events. A subscription belongs to a Facility;
Company-level events have no Facility. An event with
businessUnitId = 0and no Facility never matches a subscription.
5. A delivery whose source event is gone
WebhookDeliveryProcessor.envelopeFor rebuilds the envelope from the outbox row. If that row is
gone, the relay sends nothing: the delivery becomes DEAD with lastError source event gone, and
it counts as no attempt. A receiver therefore only ever sees a WebhookEnvelope. A redeliver
(POST /api/v1/webhook-deliveries/{id}/redeliver) resets the delivery, and it settles as DEAD
again while the row stays gone.
The row vanishes through direct database action, or through the demo reset
(POST /api/v1/demo/reset, live only when KARYO_DEMO=on), which truncates outbox_events with
RESTART IDENTITY and keeps webhook_delivery. After a demo reset, a new outbox row can reuse the
id of a vanished one before a pending delivery for that id is due. The relay then sends the new
event under the old delivery's X-Karyo-Event header. This is a known limit of the demo reset and
is a follow-up to F18; no production path deletes from outbox_events.
6. Subscription management
Seven routes, each declaring the integrations.manage action
(services/integration-hub-service/karyo-webhooks-core/src/main/kotlin/com/karyo/webhooks/api/v1/WebhookSubscriptionResource.kt, WebhookSubscriptionResource),
which the standard administrator and integrations profiles hold; each
working in the Facility of the request (a subscription is created in it, and the list, read, update,
delete, rotation and test routes find only that Facility's subscriptions):
POST /api/v1/webhook-subscriptions, GET, GET /{id}, PATCH /{id}, DELETE /{id}, plus
POST /api/v1/webhook-subscriptions/{id}/rotate-secret, which returns the new secret once, and
POST /api/v1/webhook-subscriptions/{id}/test, which enqueues a synthetic webhook.ping delivery
(WebhookSubscriptionResource). Deliveries are read and requeued through
/api/v1/webhook-deliveries, which declares the same action
(services/integration-hub-service/karyo-webhooks-core/src/main/kotlin/com/karyo/webhooks/api/v1/WebhookDeliveryResource.kt, WebhookDeliveryResource.list, WebhookDeliveryResource.redeliver).
A ping is not backed by an outbox row (outboxEventId is null) and follows the same signing and
retry path as a real delivery. Its envelope is built at delivery time
(WebhookDeliveryProcessor.envelopeFor):
{ "eventType": "webhook.ping", "scopeType": "FACILITY", "facilityId": 7,
"aggregateType": "Webhook", "aggregateId": 0, "data": { "message": "ping" } }
with the Facility of the subscription, and occurredAt set to the moment of the attempt rather than a
fixed creation time.
Pattern matching is three rules, in EventMatcher, and any one pattern in a subscription's
list is enough:
| Pattern | Matches |
|---|---|
* |
every event type |
pick-order.* |
every pick-order event (a trailing * is a prefix match) |
item-data.created |
exactly that event type |
There is no allowlist of subscribable types - whatever string an outbox row carries is matchable, so
a new event type reaches existing * and prefix subscriptions the moment it first publishes.
7. SSRF
WebhookUrlValidator is a thin wrapper over the shared OutboundUrlPolicy in libs/karyo-security,
which rejects loopback, link-local (including the EC2 metadata address),
private IPv4 ranges, IPv6 unique-local, any-local, multicast, and the literal hostnames localhost
and metadata.google.internal (OutboundUrlPolicy). WebhookHttpClient sets
followRedirects(NEVER) (WebhookHttpClient).
Host validation runs at create and update only (WebhookSubscriptionService.create and update).
Only the HTTPS requirement and its test exception are checked again at delivery time.
The relay's README says so in as many words
(services/integration-hub-service/karyo-webhooks-core/README.md, SSRF protection) and names DNS rebinding and
non-dotted-decimal IP encodings (integer, hex-octet, octal-octet) as residual risks.
OutboundUrlPolicy's own KDoc names the same two risks. It accepts them because the URLs it covers
are gated to trusted actions - integrations.manage for webhook subscriptions - and because an
installation is a silo (OutboundUrlPolicy). The KDoc describes its check as
"create-time/delivery-time". That is true of the policy's other caller, SlackAlertChannel, which
re-checks the stored Slack URL at every delivery. It is not true of WebhookUrlValidator, which
checks at create and update only.
8. The event catalogue
The outbox writer accepts 63 distinct event types, declared by PublishedEventType, plus
webhook.ping, which the relay synthesises outside the outbox. A subscription on * can receive
all 64. The writer takes the enum rather than an arbitrary string, and each enum value fixes its aggregate.
PublishedEventContractTest publishes every enum value through the writer and checks its persisted
wire name against the convention and this catalogue. Each row below names its publisher and payload.
facilityId and businessUnitId place the event. An operational event (stock, orders, picks,
waves, shipments, cross-dock, streaming, replenishment, alerts, archived documents) has scopeType FACILITY, names its Facility,
and gives that Facility's Business Unit as businessUnitId. A location event
(storage-location.lock-changed, storage-location.allocation-changed) is operational, because a location belongs to a
Facility. A master-data event (products, clients and users, templates)
has scopeType BUSINESS_UNIT and a null facilityId. A subscription belongs to one Facility and receives that Facility's operational events
and the master-data events of its Business Unit. The relay derives the subscription's Business Unit
from its Facility; subscriptions store no second ownership key. Two sibling Facilities never receive
each other's operational events, but both receive their Business Unit's master-data events. Once its Facility is archived, a subscription still receives events created at or before the archive and never receives later ones. The v1 tenantId field is gone; businessUnitId
carries the same number for the same events. Two exceptions matter to a subscriber: client.* events
carry the client row's own id, so a unit's subscription receives events about itself, and
user.created carries the compatibility id of the user concerned.
aggregateId is the aggregate's database id. The user.created envelope retains 0
for compatibility. Its version-2 payload adds stable targetPrincipalId and
actorPrincipalId; userId remains a provider/display compatibility field and must not be used as
the Karyo identity. Other identity-bearing events likewise add principal UUIDs while preserving
historical name snapshots.
Clients and users (karyo-auth-core; payloads in karyo-auth-api)
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
client.created |
Client |
a Business Unit is created | businessUnitId, name, number, code |
ClientService.createAuthorized |
client.updated |
Client |
a Business Unit's details change | businessUnitId, name, number |
ClientService.update |
client.deactivated |
Client |
a Business Unit is set inactive | businessUnitId, number |
ClientService.setState |
client.reactivated |
Client |
a Business Unit is set active again | businessUnitId, number |
ClientService.setState |
user.created |
User |
a user is provisioned | v2: userId, username, email, businessUnitId, targetPrincipalId, actorPrincipalId, identityFormatVersion |
AccessProvisioningService.complete |
karyo-auth-api also declares UserDeactivatedEvent and UserReactivatedEvent, but nothing
publishes them, so no subscriber receives a UserDeactivated or UserReactivated event. Grant and
revoke changes publish no event; they are recorded as identity change facts.
Products (karyo-product-core; payloads in karyo-product-api)
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
item-data.created |
ItemData |
a product is created | itemDataId, number, name, businessUnitId |
ProductService.createProduct |
item-data.updated |
ItemData |
a product's fields change | itemDataId, number, changedFields |
ProductService.updateProduct |
item-data.state-changed |
ItemData |
a product is activated or deactivated | itemDataId, number, oldState, newState, businessUnitId |
ProductService.applyStateChange |
item-data.deleted |
ItemData |
a product is deleted | itemDataId, number, name, businessUnitId |
ProductService.deleteProduct |
Warehouse layout (karyo-layout-core; payloads in karyo-layout-api)
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
storage-location.lock-changed |
StorageLocation |
a location's lock type changes | locationId, locationName, oldLockType, newLockType, businessUnitId |
LocationService.lockLocation |
storage-location.allocation-changed |
StorageLocation |
a location's allocation percentage changes | locationId, locationName, oldAllocation, newAllocation, businessUnitId |
LocationService.setAllocationFromEntries |
Inventory (karyo-inventory-core; payloads in karyo-inventory-api, InventoryEvents.kt)
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
stock-unit.state-changed |
StockUnit |
a stock unit is created, or its state changes | stockUnitId, itemDataId, itemDataNumber, unitLoadId, oldState, newState, amount, locationId, locationName |
StockService.createStock; StockService.changeState |
stock-unit.amount-changed |
StockUnit |
a stock unit's amount is adjusted or transferred; also on every reservation, release or reservation transfer, where changeAmount is zero and activityCode is RESERVE, RELEASE or TRANSFER_RESERVATION |
stockUnitId, itemDataId, itemDataNumber, oldAmount, newAmount, changeAmount, recordType, activityCode, locationId, locationName |
StockService.adjustAmount; StockService.transferStock; StockAmountEventPublisher.publish |
stock-unit.lock-changed |
StockUnit |
a lock is set on a stock unit, including the contents of a locked unit load | entityType, entityId, oldLock, newLock, locationId |
StockService.setLock |
unit-load.lock-changed |
UnitLoad |
a lock is set on a unit load | entityType, entityId, oldLock, newLock, locationId |
UnitLoadService.applyLockRecursive |
stock-unit.packaging-unit-changed |
StockUnit |
a stock unit's packaging unit changes | entityType, entityId, oldPackagingUnitId, newPackagingUnitId, locationId |
StockService.changePackagingUnit |
stock-unit.deleted |
StockUnit |
a stock unit is deleted | stockUnitId, itemDataId, itemDataNumber, amount, locationId |
StockService.deleteStock |
stock-unit.purged |
StockUnit |
the purge removes a terminal stock unit | stockUnitId, itemDataId, itemDataNumber, unitLoadId, amount |
StockPurgeService.purgeStockUnit |
unit-load.transferred |
UnitLoad |
a unit load moves to a location or onto a carrier, or is created in place by a move | UnitLoadTransferredEvent, including the type used for allocation |
UnitLoadService.transferToLocation; UnitLoadService.transferToCarrier; DefaultStockMover.fireCreateOnlyTransfer |
unit-load.trashed |
UnitLoad |
a unit load is retired | unitLoadId, labelId, locationId, stockUnitIds |
UnitLoadTerminator.fireTrashed |
unit-load.revived |
UnitLoad |
a retired unit load is revived by a pick | UnitLoadRevivedEvent, including the type used for allocation |
DefaultStockPicker.fireRevived |
unit-load.purged |
UnitLoad |
the purge removes an empty terminal unit load | unitLoadId, labelId |
StockPurgeService.purgeUnitLoad |
Receiving and delivery orders (karyo-orders-core; payloads in karyo-orders-api)
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
asn.state-changed |
Asn |
an advance shipping notice changes state | asnId, asnNumber, oldState, newState, businessUnitId, occurredAt |
AsnService.transition |
goods-receipt.line-received |
GoodsReceipt |
a receipt line is received | goodsReceiptId, goodsReceiptLineId, asnId, itemDataId, amount, stockUnitId, unitLoadId, unitLoadLabel, locationId, locationName, qaHold, businessUnitId, occurredAt, storageStrategyId |
GoodsReceiptService.fireLineReceived |
goods-receipt.line-reversed |
GoodsReceipt |
a received line is reversed | goodsReceiptLineId, goodsReceiptId, stockUnitId, unitLoadId, itemDataId, amount, businessUnitId |
GoodsReceiptService.fireLineReversed |
goods-receipt.state-changed |
GoodsReceipt |
a goods receipt changes state | goodsReceiptId, receiptNumber, oldState, newState, businessUnitId, occurredAt |
GoodsReceiptService.transition |
delivery-order.state-changed |
DeliveryOrder |
a delivery order changes state | orderId, orderNumber, oldState, newState, businessUnitId, occurredAt |
OrderService.transition |
Transport orders (karyo-tasks-core; payloads in karyo-tasks-api)
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
transport-order.state-changed |
TransportOrder |
a transport order changes state | transportOrderId, orderNumber, oldState, newState, businessUnitId, facilityId, occurredAt |
TransportOrderEmitter.emitStateChange |
transport-order.completed |
TransportOrder |
a transport order completes | transportOrderId, orderNumber, transportType, unitLoadId, unitLoadLabel, sourceLocationId, sourceLocationName, destinationLocationId, destinationLocationName, operatorId, businessUnitId, facilityId, occurredAt, itemDataId, amount, confirmedAmount, partial |
TransportOrderEmitter.fireCompleted |
Picking, packing and shipping (karyo-fulfillment-core; payloads in karyo-fulfillment-api)
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
pick-order.created |
PickOrder |
a pick order is created on release, as a batch pick order, or as an extinguish order (deliveryOrderId is null for the last two) |
pickOrderId, pickOrderNumber, deliveryOrderId, businessUnitId, pickCount, occurredAt |
PickOrderService.persistPickOrder; WavePickService.persistBatchPickOrders; ExtinguishService.mintExtinguishOrder |
pick-order.picked |
PickOrder |
every pick on the order is confirmed | pickOrderId, pickOrderNumber, deliveryOrderId, businessUnitId, occurredAt |
PickOrderService.finishPickOrderIfDone |
pick-order.released |
PickOrder |
a claimed pick order is handed back to the pool; managerOverride is true only when the releaser is not the holder |
pickOrderId, pickOrderNumber, deliveryOrderId, releasedFrom, releasedBy, managerOverride, businessUnitId, occurredAt |
PickOrderService.release |
pick-order.canceled |
PickOrder |
a pick order is force-finished, cancelling its open picks | pickOrderId, pickOrderNumber, deliveryOrderId, businessUnitId, canceledPickCount, keptPickedCount, occurredAt |
PickLifecycleService.forceFinish |
pick-order.picks-added |
PickOrder |
picks are added to an existing pick order | pickOrderId, pickOrderNumber, deliveryOrderId, businessUnitId, addedCount, occurredAt |
PickTopUpService.persistTopUp |
pick-order.claim-warning-accepted |
PickOrder |
a non-claimant explicitly acknowledges a claim warning in the successful confirmation transaction; the claim is not transferred | PickClaimWarningAccepted |
PickConfirmationAccess.kt |
pick-order.bulk-confirmed |
PickOrder |
a bulk pick is confirmed on a batch pick order | pickOrderId, sourceStockUnitId, pickedAmount, filledSlices, shortSlices, slices |
BulkPickService.bulkConfirm |
pick.shortfall-reported |
Pick |
a short pick's remainder is reported under the partial-ship shortfall strategy | pickId, deliveryOrderId, deliveryOrderLineId, itemDataId, shortfall, resolution, businessUnitId, occurredAt |
PartialShipShortfallStrategy.handle |
shipment.state-changed |
Shipment |
a shipment changes state while packing, shipping or consolidating | shipmentId, shipmentNumber, deliveryOrderId, oldState, newState, businessUnitId, occurredAt |
PackingService.publishState; ShippingService.publishState; DefaultConsolidationPackPort.publishState |
shipment.canceled |
Shipment |
a shipment is cancelled | shipmentId, shipmentNumber, deliveryOrderId, businessUnitId, restoredUnitCount, occurredAt |
ShippingLifecycleService.publishCanceled |
shipment.shipping-unit-removed |
Shipment |
a shipping unit is removed from a shipment | shipmentId, shippingUnitId, shippingUnitNumber, resultingState, businessUnitId, occurredAt |
ShippingLifecycleService.publishRemoved |
shipment.group-opened |
Shipment |
a consolidation group's shipment is opened | a map: consolidationGroupId, waveId, orders |
DefaultConsolidationPackPort.openGroupShipment |
shipment.container-closed |
Shipment |
a consolidation container is closed | a map: containerId, weight |
DefaultConsolidationPackPort.closeContainer |
Batch pick orders and consolidation are driven by the wave-fulfilment engine through seams the
shared modules declare and implement (ConsolidationPackPort). The batch variant of
pick-order.created, pick-order.bulk-confirmed, shipment.group-opened and shipment.container-closed
are published only when that capability is triggered.
Stocktaking (karyo-stocktaking-core)
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
count-order.released |
CountOrder |
a claimed count order is handed back to the pool (its state stays GENERATED) |
countOrderId, orderNumber, locationId, locationName, releasedFrom, releasedBy, managerOverride, businessUnitId, occurredAt |
StocktakingService.release |
Document archive (karyo-docstore-core; payloads in karyo-docstore-api)
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
document.stored |
Document |
a rendered document is archived with ?store=true |
documentId, entityType, entityId, documentType, facilityId |
DocumentStoreService.store |
document.deleted |
Document |
an archived document is deleted | documentId, entityType, entityId, documentType, facilityId |
DocumentStoreService.deleteById |
Document templates (karyo-doctemplates-core; payloads in karyo-docstore-api)
A template override belongs to a Business Unit, so these are master-data events: scopeType is
BUSINESS_UNIT and facilityId is null.
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
document-template.uploaded |
DocumentTemplate |
a new template version is uploaded and made the active one | templateId, businessUnitId, templatePath, templateVersion |
DocumentTemplateService.upload |
document-template.activated |
DocumentTemplate |
an older template version is made the active one | templateId, businessUnitId, templatePath, templateVersion |
DocumentTemplateService.activate |
document-template.deleted |
DocumentTemplate |
a template version is deleted | templateId, businessUnitId, templatePath, templateVersion |
DocumentTemplateService.delete |
Waves (karyo-wave-core; payloads in karyo-wave-api)
aggregateId is the wave's id for every wave event, the consolidation and sort events included.
Wave states are integer codes: PLANNED 100, RELEASED 300, PICKING 400, CONSOLIDATING 500,
COMPLETED 700, CANCELLED 900.
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
wave.state-changed |
Wave |
a wave changes state, once for every transition, so a release and a cancel publish it too | waveId, waveNumber, oldState, newState, facilityId, occurredAt |
WaveService.transition |
wave.released |
Wave |
a wave is released, after its wave.state-changed; the payload is the same |
waveId, waveNumber, oldState, newState, facilityId, occurredAt |
WaveService.release |
wave.canceled |
Wave |
a wave is cancelled, after its wave.state-changed; the payload is the same |
waveId, waveNumber, oldState, newState, facilityId, occurredAt |
WaveService.cancel |
wave.consolidation-group-ready |
Wave |
a consolidation group is marked ready, by hand or when its last line is sorted | a map: groupId, sortSlot, trigger (MANUAL or AUTO) |
WaveService.markGroupReady |
wave.sort-scanned |
Wave |
an operator sorts an item into a consolidation group at the sort station | a map: scanId, groupId, lineId, amount, operatorId, operatorPrincipalId, identityFormatVersion |
SortStationService.scan |
wave.sort-undone |
Wave |
a sort scan is undone | a map: scanId, groupId, amount, operatorId, operatorPrincipalId, identityFormatVersion |
SortStationService.undo |
Cross-dock (karyo-crossdock-core; payloads in karyo-crossdock-api)
aggregateId is the cross-dock order's id, and the aggregate type is the lowercase string
cross-dock.
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
cross-dock.matched |
cross-dock |
a received line is matched to an open delivery order line and a staging move is created | crossDockOrderId, crossDockType, goodsReceiptLineId, deliveryOrderLineId, itemDataId, amount, stagingLocationId, facilityId, occurredAt |
CrossDockInterceptor.mintOrder |
cross-dock.staged |
cross-dock |
the staging transport order completes | crossDockOrderId, facilityId, occurredAt |
CrossDockLifecycleService.onTransportCompleted |
cross-dock.completed |
cross-dock |
the matched reservation is found already consumed, at the expiry sweep or on a cancel | crossDockOrderId, facilityId, occurredAt |
CrossDockLifecycleService.markCompleted |
cross-dock.cancelled |
cross-dock |
an operator cancels a matched or staged order | crossDockOrderId, facilityId, occurredAt |
CrossDockLifecycleService.cancel |
cross-dock.expired |
cross-dock |
a matched order passes its staging deadline; action is AUTO_PUTAWAY (the order becomes EXPIRED) or ALERT (the deadline is pushed forward, the order stays open, and the match is flagged for the Cross-dock expiry monitor's next check) |
crossDockOrderId, action, facilityId, occurredAt |
DefaultCrossDockExpiryHandler.publishExpired |
The ALERT expiry action keeps the reservation, extends the deadline and retains the first missed
deadline on the match. The existing monitor evaluator reads that flag, not the event.
With Monitors and its Cross-dock expiry rule enabled, the next check raises one operator-visible
alert per open flagged match at the configured threshold (zero hours by default).
Deadline extensions preserve an open alert; completing, cancelling or auto-expiring the match clears
its condition. A webhook subscriber is optional, not required for the operator alert.
See Cross-docking.
Order streaming (karyo-streaming-core; payloads in karyo-streaming-api)
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
delivery-order.stream-escalated |
DeliveryOrder |
a streamed order that is still short has waited longer than its strategy's maximum wait; published once for each order | orderId, orderNumber, strategyId, firstAttemptAt, escalatedAt, pendingLineCount |
StreamingService.escalate |
delivery-order.stream-stalled |
DeliveryOrder |
a streamed order leaves the pool for good; reason is abandon window elapsed, strategy deleted, no longer effectively STREAM, or the message of the failure that stopped the attempt |
orderId, orderNumber, strategyId, firstAttemptAt, stalledAt, reason |
StreamingService.stall |
stream-batch.flushed |
StreamBatch |
a streaming tick finishes and records its batch | batchId, strategyId, trigger, candidateCount, releasedCount, pushedCount, shortCount, retriedCount, stalledCount, flushedAt |
StreamingService.recordBatch |
Alerts (karyo-monitors-core; payloads in karyo-monitors-api)
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
alert.fired |
alert |
a monitor opens a new alert | the alert: id, monitorKey, monitorName, severity, status, scope, reason, suggestedFix, observedValue, firstFiredAt, lastSeenAt, resolvedAt |
AlertService.openAlert |
The relay's own
| Event type | Aggregate | Published when | data fields |
Published at |
|---|---|---|---|---|
webhook.ping |
Webhook |
POST /api/v1/webhook-subscriptions/{id}/test |
message (always "ping") |
WebhookSubscriptionService.ping |
What the engines need before they publish
The engine modules (waves, cross-dock, streaming, monitors and document templates) publish through
the same outbox, and the relay delivers them exactly like the rest: there is no allowlist, so a *
or prefix subscription receives their types as well. An engine publishes only when its own switches
let it act. See
engine capabilities
for what each engine needs before it acts.
Naming, and why it matters to a pattern
Every type follows aggregate.event: exactly one dot, lowercase words, and hyphens within each
part. The aggregate names the row identified by aggregateId, for example
stock-unit.lock-changed, unit-load.lock-changed and delivery-order.stream-stalled.
The aggregateType field retains its existing spelling, such as StockUnit.
One prefix now covers each aggregate. pick-order.* includes creation, claim warnings and bulk
confirmation. shipment.* includes shipping-unit removal, group opening and container closing.
LockChanged has two replacements: stock-unit.lock-changed and unit-load.lock-changed.
This is a breaking rename before 2.0.0. Receivers must update exact and prefix patterns to the names in this catalogue; Karyo does not publish old aliases. Existing outbox and delivery rows are not rewritten, so pending pre-upgrade rows retain their old names. Drain those rows before switching receiver filters. The envelope schema and payload fields do not change. Deactivation still drops events, and retries still have no ordering guarantee, as section 4 states.
Related
- Events and the outbox - the internal half
services/integration-hub-service/karyo-webhooks-core/README.md- the relay's own SSRF and configuration notes- Identity for an integrating system - who may manage subscriptions, and why the
integratorprofile alone cannot - Strategies and runtime configuration ยง5 - the
karyo.webhooks.*knobs