Class EventProcessor

java.lang.Object
org.chenile.core.event.EventProcessor

public class EventProcessor extends Object
A sequential way of processing an event within the same thread. Sends the event payload to each of the event subscribers in a loop. This can be used if a simple SEDA pipeline needs to be established in the same thread within a single transaction. An example of this is logging threads which need to do a bunch of things before a user is considered to be logged in.

This should not be used if parallelism is desired.

This is a very handy way of doing testing. It is also internally used by all Chenile subscribers at the entry point. Chenile file watcher, scheduler etc. use this class internally.

  • Field Details

  • Constructor Details

    • EventProcessor

      public EventProcessor()
  • Method Details

    • handleEvent

      public void handleEvent(String eventId, Object eventPayload)
    • handleEvent

      public void handleEvent(String eventId, Object eventPayload, Map<String,String> headers)
    • handleEventAsync

      public void handleEventAsync(String eventId, Object eventPayload)
    • handleEvent

      public void handleEvent(ChenileEventDefinition ced, ChenileExchange chenileExchange)
    • setHeaders

      protected void setHeaders(ChenileExchange chenileExchange)
      An Extension point to allow subclasses to set the headers in the Chenile Exchange prior to invoking it. These headers would be app specific and hence this class needs to be subclassed by the actual application for the purpose of setting headers.
      Parameters:
      chenileExchange -