spring-modulith icon indicating copy to clipboard operation
spring-modulith copied to clipboard

Marker interfaces for domain events

Open cmetzlerhg opened this issue 1 year ago • 4 comments
trafficstars

Hi,

we're currently integrating the transactional outbox with spring-data-jpa and spring-modulith. In our current code, we have use cases where we use

// We're not using @Async here, because the executed code is already creating a new thread
@TransactionalEventListener(SomethingHappenedEvent.class)
void handleSomeEvent() {
  //  react on something has happened without the need for its actual content 
}

It seems that @ApplicationModuleListener does not support specifying the class of the event and if we use the @TransactionalEventListener as before, we run into an IndexOutOfBounds exception, when trying to replay failed events.

Our workaround is now to add the parameter to the method signature, however it is not used, so the static code analysis shows an unused parameter.

cmetzlerhg avatar Jun 06 '24 06:06 cmetzlerhg