Event Messages
Event messages notify syndication consumers that new projections are available. The event message contains information for the syndication consumer to determine the changes in the projection. For more information about projections, see the Syndication Projection section. There are two types of event messages:
- Domain event: An event generated when a catalog domain object is updated
- Category event: A message with the built projection’s Global Unique Identifier (GUID)
For more information about adding event message types, see the Adding New Event Type section.
Domain Event Messages
Domain event messages are the messages that Elastic Path Commerce Manager sends to integration server using Java Messaging Service (JMS) about the catalog updates, which are the domain event messages. You can create, update, or delete any of the following to trigger an event:
- Product, Bundle, or Product SKU
- Category
- Product or SKU Attribute
- Sku Option
- Brand
- Modifier Group
The domain event message contains the following information:
class
: The type of message, such asDomainEventType
name
: The event type, such asSKU_OPTION_CREATED
guid
: The code for the entity, such as product code
The projection builder receives the event message in the following format:
{
"eventType":{
"@class":"DomainEventType",
"name":"<EVENT_TYPE>"
},
"guid":"<ENTITY_CODE>",
"data":{}
}
When you update data, Elastic Path Commerce Manager sends a VirtualTopic.ep.domain
message to JMS. The following events trigger the projection builder to run an appropriate action:
- Create, update, or delete the following entities:
PRODUCT
CATEGORY
CATEGORY_LINK
ATTRIBUTE
SKU_OPTION
BRAND
MODIFIER_GROUP
Catalog Event Messages
A catalog event message contains the following information:
class
: The type of message, such asCatalogEventType
name
: The event type, such asOPTIONS_UPDATED
guid
: The aggregate of all updated codes to sent in one listmodifiedDateTime
: The time stamp of the projection buildstore
: The code to identify the storetype
: The projection type, such as option or brand
When the projection builder completes building the updates, Elastic Path Commerce Manager sends a message to the VitrutalTopic.ep.catalog
topic to notify the Content Management System (CMS).
The following projection event types initiate a VirtualTopic.ep.catalog
message:
OPTIONS_UPDATED
BRANDS_UPDATED
FIELD_METADATA_UPDATED
ATTRIBUTES_UPDATED
OFFERS_UPDATED
CATEGORIES_UPDATED
For CMS to consume projections, a catalog event message is sent to notify updates. The message is sent to the catalog events channel. The following is an example of a catalog event message:
{
"eventType": {
"@class": "CatalogEventType",
"name": "OPTIONS_UPDATED"
},
"guid": "AGGREGATE",
"data": {
"type": "option",
"store": "MyStore",
"modifiedDateTime": "2018-01-01T14:47:00+00:00",
"codes": [
"COLOUR",
"SHAPE"
]
}
}
note
The GUID is listed as AGGREGATE
, so the integration server sends events, consisting of all updates, in a single catalog event message.
The CMS consumes a catalog event message and uses the Syndication API to fetch projections.