I can only come to the conclusion that there must be a bug hiding out somewhere…
With this in application.yaml
axon:
serializer:
events: jackson
general: xstream
messages: xstream
eventhandling:
processors:
projections:
mode: pooled
thread-count: 8
initial-segment-count: 16
Only the first event returned in the stream from my ContextAwareEventMultiUpcaster
is passed on to the @EventHandler
. (I tested by changing the order of events returned in the stream by the ContextAwareEventMultiUpcaster
).
With pooled-config present, methods in @Aggregate
s annotated with @EventSourcingHandler
receive the events created by the ContextAwareEventMultiUpcaster
.
With pooled-config present, code like this eventStore.readEvents(id).asStream().toList()
sees all events created by the ContextAwareEventMultiUpcaster
.
its only the calls to @EventHandler
that is missing
If I remove pooled the config,
axon:
serializer:
events: jackson
general: xstream
messages: xstream
then all @EventHandlers
are called as expected.
If I add the config code that you suggested (and make sure pooled is not in application.yaml):
@Autowired
fun configProcessor(processingConfigurer: EventProcessingConfigurer) {
processingConfigurer.registerPooledStreamingEventProcessor("projections")
}
I get an error:
Event processor with name projections already exists
Is that because my @Component
with the @Eventhandler
is configured with @ProcessingGroup("projections")
and is already created?
My confusion about ContextAwareEventMultiUpcaster
was about when ContextAwareSingleEntryMultiUpcaster::buildContext
is called.
If I do
eventStore.readEvents(id).asStream().toList()
I would expect ContextAwareSingleEntryMultiUpcaster::buildContext
to be called once, since I am reading one aggregate? Thats not the case.
I have a stream of events:
A -> A -> A
I implement ContextAwareSingleEntryMultiUpcaster
to split the stream into
A -> B -> A -> B -> A -> B
But, I would really like the stream of new events to be
A -> B -> A -> A
Since the information in B in this case hasnt changed. I tought I could keep this info, the latest value of B, in the context, but buildContext seems to be called more often than once per aggregate?
My confusion of this has nothing to do with the bug. Right now my stream looks like:
A -> B -> A -> B -> A -> B
But B never reach the @EventHandler
when config is pooled.
Framework 4.5.5 with server 4.5.9 (not enterprise)
Thanks!