Extension Point: Product Events
Basics
Parameter | Value |
---|---|
Extension Point Key | PRODUCT_EVENT |
Extension Point Name | Product Events |
Extension Interface | ProductEvent |
Supports Multiple Extensions? | Yes |
Selector Type | None |
Available Since | 1.4.0 |
Use Cases
Extensions implementing this Extension Point are notified when products are created or updated. The XPFProductEventContext
contains details about the product.
Methods
getDeliveryPolicy
The getDeliveryPolicy
method is invoked during Integration Server startup. It allows the extension to define how retries should be handled if the extension throws an exception. The extension needs to return the following values in the XPFDeliveryPolicy
response object:
consumerQueueName
: An identifier for the consumer message queue that will be used to track events and allow them to be processed asynchronously. This value should be unique for all extensions assigned to this extension point.maximumRedeliveries
: The maximum number of redelivery attempts before the message is sent to the dead letter queue.redeliveryDelay
: The delay between redelivery attempts, in milliseconds.
created
The created
method is invoked when a product is created.
updated
The updated
method is invoked when a product is updated.
Extension Sample
@SuppressWarnings("checkstyle:magicnumber")
@Extension
@XPFAssignment(extensionPoint = XPFExtensionPointEnum.PRODUCT_EVENT, priority = 100)
public class SegmentProductEvents extends XPFExtensionPointImpl implements ProductEvent {
@Override
public XPFDeliveryPolicy getDeliveryPolicy() {
XPFDeliveryPolicy xpfDeliveryPolicy = new XPFDeliveryPolicy();
xpfDeliveryPolicy.setConsumerQueueName("pimNotifier");
xpfDeliveryPolicy.setMaximumRedeliveries(10);
xpfDeliveryPolicy.setRedeliveryDelay(10000); // 10 seconds
return xpfDeliveryPolicy;
}
@Override
public void created(final XPFProductEventContext context) {
XPFProduct product = context.getProduct();
// Notify the PIM about the new product
}
@Override
public void updated(final XPFProductEventContext context) {
XPFProduct product = context.getProduct();
// Notify the PIM about the updated product
}
}