Asynch event processing and Sagas

Hi Allard,

To implement async event processing, I’ve configured an async cluster as shown in config snippet below:

public EventBus eventBus(ClusterSelector clusterSelector,
EventBusTerminal eventBusTerminal) {

return new ClusteringEventBus(clusterSelector, eventBusTerminal);

public ClusterSelector clusterSelector(
@Qualifier(“asyncExecutor”) Executor executor) {
// Create an event bus that dispatches events asynchronously, using multiple
// threads, while guaranteeing that events for each aggregate ID are
// dispatched to listeners in the order of their production.
Cluster cluster = new AsynchronousCluster(queueName + QUEUE_UNIQUIFIER,
executor, new SequentialPerAggregatePolicy());

return new DefaultClusterSelector(cluster);

I will also be implementing a Saga, so a few questions:

  1. With the AysnchronousCluster, do I need to configure an AsyncAnnotatedSagaManager or an AnnotatedSagaManger?
  2. Do I need to configure a transaction manager for the async event handling or async saga handling?



  1. if your cluster is already asynchronous, it is not required to also make your SagaManger asynchronous. You could, but it would just add additional thread-handoffs. Performance tests should point out if it is required.
  2. If you event handlers require a transaction to do their work, then yes, you should configure a transaction manager on the async cluster. JPA, for example, won’t work nicely unless there is a transaction active.

Hope this helps.