dw.event.EventManager
Custom events must be declared in a cartridge's package.json "events" array. For example:
{
"events": [
"com.example.checkout.abandoned",
"com.example.checkout.payment_failed",
"com.example.checkout.order_placed"
]
}
After events are declared, they may be configured in Business Manager and called from any cartridge.
Dispatch is fire-and-forget: events are normally delivered asynchronously, and transport failures may result in a retry later. Attempting to send an event without a configured route is a no-op and silently ignored, while attempting to use an undeclared event ID will result in an exception.
var EventManager = require('dw/event/EventManager');
var mgr = new EventManager();
mgr.sendEvent('com.example.checkout.abandoned', JSON.stringify({ basket: basketID }));
true only when the given event exists and has a configured endpoint. It returns
false in all other cases.
This is a point-in-time hint, not a delivery guarantee. Routing can change before a subsequent send, and this method does not validate a payload, check transaction state, or reserve queue or rate-limit capacity.
true if this event maps to a route, false otherwise.
If no routing is defined for the event, this does nothing.
eventID or message is null.
If no routing is defined for the event, the event is not sent.
Rate-limit capacity is consumed when this method is called and is not restored if the transaction rolls back.
eventID or message is null.