Creation of a New BusinessEvent Handler
Class
The function enables you to create a new BusinessEventHandler class, in other words, it explains how you create your own event capturer extended from BusinessEventTealeafCapturer, delivered by SAP E-Commerce.
The class BusinessEventTealeafCapture uses framework API. The coding should resemble the following syntax:

public class ZCapturer extends BusinessEventTealeafCapturer {
/**
* capture own business events
* use framework api to capture your events
* @see
com.sap.isa.businessobject.businessevent.event.capturer.
* EventCapturer
*/
public void captureBusinessEvent
(BusinessEvent event,
BusinessObjectManager bom,
HttpServletRequest request) {
If (event instanceof ZEvent) {
CapturerEvent zEvent = createEvent(request, "MYEVENT");
zEvent.setProperty("ZGroup", "ZProperty", "dummyValue");
zEvent.publish();
}
}

Overwrite the captureBusinessEvent method. Within this method you can find your events using the instance of operator.
The new handler class extends com.sap.isa.isacore.BusinessEventTealeafCapturer.
For the new BusinessEventHandler class, the coding should resemble the following syntax:

public class ZCapturer extends BusinessEventTealeafCapturer {
/**
* capture own business events
* use framework api to capture your events
* @see
com.sap.isa.businessobject.businessevent.event.capturer.
* EventCapturer
*/
public void captureBusinessEvent(BusinessEvent event, BusinessObjectManager bom, HttpServletRequest request) {
if (event instanceof RequestHelpEvent) {
RequestHelpEvent requestHelpEvent = (RequestHelpEvent) event;
User user = (User)requestHelpEvent.getSource();
Shop shop = (Shop)requestHelpEvent.getShop();
try {
CapturerEvent newEvent = createEvent(request, "ZCUSTOMER_REQ_HELP");
newEvent.setProperty("ZCUSTOMER_REQ_HELP ", "HELPTYPE", requestHelpEvent.getHelpType());
newEvent.setProperty("ZCUSTOMER_REQ_HELP ", " CUSTOMER_ID ", user.getUserId());
newEvent.setProperty("ZCUSTOMER_REQ_HELP ", "WEB_SHOP", requestHelpEvent.getHelpType());
newEvent.setProperty("ZCUSTOMER_REQ_HELP ", "PRODUCT_CATALOG", shop.getCatalog().substring(0,29));
newEvent.setProperty("ZCUSTOMER_REQ_HELP ", "WEB_SHOP_VARIANT", shop.getCatalog().substring(30));
newEvent.setProperty("ZCUSTOMER_REQ_HELP ", "LANGUAGE", user.getLanguage());newEvent.publish();
newEvent.publish();
}
catch (Exception ex){
}
}
}
}
Overwrite the captureBusinessEvent method. Within this method you can find your events using the instanceof operator.
See also: