Projection Driven Bulk Changes
Business users and merchandisers create entities, such as brands or attributes, in Elastic Path Commerce Manager. These entities are added as offer attributes in a product or product bundle in the store. With catalog syndication, an entity has a projection created for syndication. A domain event message notifies the projection builder to build the projection for the specified entity. When a projection has updates, such as a change to the brand or attribute, any offers that contain the entity must also be updated. For more information about domain events, see Catalog Syndication Event Messages.
With projection driven bulk changes, catalog syndication consumers can rebuild only the offers with the affected value, instead of all offers. For example, a business user updates the color of a T-shirt from Crimson Red to Ruby Red. There are multiple offers with this item. Using projection bulk changes, any offers with the Crimson Red T-shirt are automatically updated to Ruby Red.
For projection driven bulk changes, when you update and process a projection, a database query returns the list of all products and offers containing the entity. You can use the following projection types to update projection driven bulk changes:
BRAND_BULK_UPDATE
BUNDLE_BULK_UPDATE
ATTRIBUTES_BULK_UPDATE
OPTIONS_BULK_UPDATE
CATEGORIES_BULK_UPDATE
The projection builder processes and sends one or more <entity>_BULK_UPDATE
messages to the VirtualTopic.ep.domain.bulk
topic in the Java Messaging Service (JMS) for the catalog syndication consumer.
One bulk update message might result in multiple catalog event messages with offer codes. You can configure the number of offer codes to send in a single message with the environment property bulkChangeMaxEventSize
. For example, if the bulk change affects 1000 offers, you can configure bulkChangeMaxEventSize
to send 100 offer codes within a single message. This is a total of 10 event messages to VirtualTopic.ep.catalog
.
The following is an example of the <entity>_BULK_UPDATE
message format:
{
"eventType": "<ENTITY>_BULK_UPDATE",
"guid": "<ENTITY_CODE>",
"data": {
"products": ["<RELATED_PRODUCT_CODE_1>", "<RELATED_PRODUCT_CODE_2>", …]
}
}
Workflow
This section provides a detailed workflow of projection driven bulk changes. Projection bulk changes ensure that any updates made to the projection are also made to any offer associated with the projection. For example, a business user updates the color of a T-shirt from Crimson Red to Ruby Red. There are multiple offers with this item. Using projection bulk changes, any offers with the Crimson Red T-shirt are automatically updated to Ruby Red.
The following diagram illustrates the workflow for projection driven bulk changes:
Store administrator updates the store catalog in Elastic Path Commerce Manager.
Elastic Path Commerce sends a domain event message to the Domain Event Channel to notify of a change, such as
SKU_OPTION_UPDATED
orBRANDS_UPDATED
.Projection builder consumes the domain event message from
VirtualTopic.ep.domain
and builds the projection.Projection builder sends an entity catalog event, such as
OPTION
orBRAND
, toVirtualTopic.ep.catalog
.Projection builder sends an
<ENTITY>_BULK_UPDATE
message, such as options, brands, or attributes, toVirtualTopic.ep.domain.bulk
in Java Messaging System (JMS).Projection builder consumes the
VirtualTopic.ep.domain.bulk
message from the Domain Bulk Event Channel.Domain Bulk Event Channel consumes the event.
The message contains a list of codes for all affected offers.
Projection builder updates the affected offers with the updated information and sends catalog event messages to the Catalog Event Channel with the changes.
Content Management System (CMS) consumes the event message.