Uploaded image for project: 'Event Module'
  1. Event Module
  2. EVNT-36

Improve implementation of how events are fired



    • Enhancement
    • Status: Closed
    • TBD
    • Resolution: Won't Fix
    • None
    • None
    • Medium



      Whenever items are added, updated or deleted the module publishes events via activeMQ which happens to queue messages asynchronously, this isn't always ideal e.g when the order of occurrence of events matters to the listeners, there is also several other limitations to listeners since there custom code is invoked outside of the transaction context and thread in which the action(s) took place.

      The goal of this ticket is to support firing of the events synchronously too.

       Dev Notes

      Update this interceptor with the changes below:

      • Update code in afterTransactionCompletion() method to publish events via a standard event mechanism like that of spring, please refer to spring documentation here, the default event publisher in spring uses a multicaster that publishes events synchronously which would need to be changed to be asynchronous by configuring a SimpleAsyncTaskExecutor on the event multicaster, refer to spring documentation for more details on how to set this up. For backwards compatibility, add a default listener that basically maintains the current functionality i.e uses activeMQ.
      • In order to support synchronous listener invocations, we need to implement beforeTransactionCompletion() with the same logic as that in afterTransactionCompletion() but using the default spring config that publishes events synchronously, this will allow listeners to participate in the same transaction context and in theory failure from any listener should halt everything.


      Possibly we should have separate event types for each interceptor method from where we fire events so that the listeners know which one to subscribe to based on their preference of synchronous vs asynchronous or participate in transaction vs not.

      Gliffy Diagrams




              Unassigned Unassigned
              wyclif Wyclif Luyima
              0 Vote for this issue
              3 Start watching this issue