Events and Listeners
Events and Listeners
https://help.sap.com/viewer/3fb5dcdfe37f40edbac7098ed40442c0/1808/en-US/ab945b81e3474a14bba99169ccfd3d7b.html
The Event System is a framework provided by the ServiceLayer that allows you to send and receive events within SAP Commerce.
You can set up components of your extension to publish events that are then received by registered listeners. Listeners are objects that are notified of events and perform business logic depending on the event that occured. Events can be published either locally or across a cluster of nodes. You can register new listeners as Spring beans in your Spring configuration XML file.
The platform defines and publishes events for a number of predefined types of event. These include the AfterItemCreationEvent type, items of which are published after any new data item is saved to the database. To process these AfterItemCreationEvent events, you provide a listener class and register it with the event framework.
For your concerttours extension, you want to generate items of news that you can potentially send out to registered subscribers through various channels. You want to create a new News item whenever a new band is signed. In your listener class, you override the onEvent method to specify the code you want to execute when this event occurs. In this case, you are checking to see if the new item is a band. If it is, you ask the platform model service to create and save a new news item.
Comments
Post a Comment