Handling Staged Content Item Events

By default, neo.xredsys.api.services.AsyncEventListenerService does not handle events generated for staged content items (see Content Item Staging). If you want your event listener to be able to handle events for staged content items as well as ordinary content items then you need to explicitly extend it to implement the neo.xredsys.api.StagedEventListener marker interface.

To make our example event listener handle staged content items as well, therefore, all we need to do is modify the class declaration as follows:

public class NewArticleNotifier extends AsyncEventListenerService implements StagedEventListener {
  ...
}

This event listener will now handle events for all content items, both staged and unstaged. If you only want to handle events for staged content items (or handle staged content items differently), you can either:

  • Use the new neo.xredsys.api.Article.isStaged() method to distinguish between staged and unstaged content items, or

  • Check if the event has a Parameter property called event-type-parameter with the value staged

The following code, for example, will filter out all events for unstaged objects:

if ("staged".equals(pEvent.getParameter("event-type-parameter")) {
  //process the event
} else {
 //do nothing
}