I have a shared lib that provides a bean that implements a method annotated with "EventHandler" and builds a projection (which is stored via jpa).
Multiple clients use this lib to build their own projection of frequently changing data so they do not have to perform a REST or QueryHandler remote call to access the data. For developer convinience and information hiding, the "how events are handled and stored in a projection database" is hidden in the shared lib.
Now I have two apps running using the lib and get a "duplicated sequment claim" warning in axon server.
I guess this is because no matter if I leave the eventProcessor name to the default (=package of the EventHandlerBean in the shared lib) or if I set a custom name via @processinggroup, the name of all eventprocessors will be the same, although they are running in different applications.
From my knowlegde (correct me if I am wrong) this will result in the two applications sharing the same processor name and thus each event might go to either of the apps, but not both. This is a problem for us, since we do rely on correct handling of changes in both (or multple) apps.
We had a similar problem with a shared KafkaListener in the past and solved it by using SPEL in the listener name defined in the annotation. This allows us to use applicationNames, counters, ... to identify listeners.
This does not seem to be possible with axon/axon-spring-autoconfiguration at the moment.
Possible workaround:
- make the shared EventHandler abstrat and force extending it in the app that wants to use it ... so I have control how it will register.
Solution idea:
- Open the EventProcessingModule to allow an optional converter in the TypeProcessingGroupSelector so before using the typeFallback, the value of processingGroup can be converted by a spel processor
I have a shared lib that provides a bean that implements a method annotated with "EventHandler" and builds a projection (which is stored via jpa).
Multiple clients use this lib to build their own projection of frequently changing data so they do not have to perform a REST or QueryHandler remote call to access the data. For developer convinience and information hiding, the "how events are handled and stored in a projection database" is hidden in the shared lib.
Now I have two apps running using the lib and get a "duplicated sequment claim" warning in axon server.
I guess this is because no matter if I leave the eventProcessor name to the default (=package of the EventHandlerBean in the shared lib) or if I set a custom name via @processinggroup, the name of all eventprocessors will be the same, although they are running in different applications.
From my knowlegde (correct me if I am wrong) this will result in the two applications sharing the same processor name and thus each event might go to either of the apps, but not both. This is a problem for us, since we do rely on correct handling of changes in both (or multple) apps.
We had a similar problem with a shared KafkaListener in the past and solved it by using SPEL in the listener name defined in the annotation. This allows us to use applicationNames, counters, ... to identify listeners.
This does not seem to be possible with axon/axon-spring-autoconfiguration at the moment.
Possible workaround:
Solution idea: