question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PooledStreamingEventProcessor: Token is not updated if no matching event handler is present

See original GitHub issue

Basic information

Steps to reproduce

I’m afraid we stumbled upon an issue with the PooledStreamingEventProcessor. I created a reproducer at https://github.com/OLibutzki/axon-token-issue.

In my example I have two events: Event1 and Event2. There are 4 event handling components. Each component is assign to a seperate event processor by using @ProcessingGroup. For simplicity the number of initial segment is set 1 for each event processor.

PooledStreamingEvent1Handler handles Event1 and is backed by a PooledStreamingEventProcessor. PooledStreamingEvent2Handler handles Event2 and is backed by a PooledStreamingEventProcessor. TrackingEvent1Handler handles Event1 and is backed by a TrackingEventProcessor. TrackingEvent2Handler handles Event2 and is backed by a TrackingEventProcessor.

In my test case I publish Event1 and expect the token to be updated to index 1 within one second. There is a test for each ProcessingGroup.

Unfortunately, the test fails for the PooledStreamingEventProcessor if there is no event handler which handles the published event. When Event1 is published the token of PooledStreamingEvent2Handler remains null as PooledStreamingEvent2Handler does not have an event handler for Event1.

This is a difference compared to the TrackingEventProcessor which updates the token regardless of having a matching event handling component.

First of all I assumed that it might be related to the initial token being null, but I added another test which published Event2 and then Event1. The token of PooledStreamingEvent2Handler remains at Index 1 in this case, althogh I expect it to be at index 2.

The consequences are annoying because the events are processed again and again as the token is not updated in the expected way.

Expected behaviour

The token is updated regardless of the existence of a event handling component for the published event.

Actual behaviour

The token is not updated if the published event is not handled by the any event handler of the event processor.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
smcvbcommented, Jun 2, 2021

Spotted what caused the problem The eventFilter invoked on line 515 of the Coordinator removes the event and filters it out of the event stream because there’s no handler interested. The fact the token isn’t updated, however, deviates from the desired outcome. We’ll take a look at resolving this for 4.5.2.

In the meantime, you can add the (albeit ugly) workaround of:

  1. Adding a no-op event handler for the event
  2. Adding a no-op event handler for event type Object, as this will effectively catch every event for which something more specific hasn’t been defined

We’ll be sure to update this issue accordingly when the PR adjusting this behavior has been provided. And, as always, thanks for showing this insight, @OLibutzki!

1reaction
OLibutzkicommented, Jun 2, 2021

It looks like that the ProcessingEntry is not put into the processingQueue. Therefore the lastConsumedToken is not updated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[MQTT Microservices] There is no matching event handler ...
Current behavior. I'm trying to handle the message published from online MQTT broker using @MessagePattern . But I'm getting the error.
Read more >
Streaming Event Processors - Axon Reference Guide
Whenever a Streaming Processor's event handlers show unexpected behavior in the form of missed or reprocessed events, a new initial token might have...
Read more >
Nestjs - There is no matching event handler defined in the ...
I'm getting the same error message but it's happening randomly not every time while a call has been produced from origin service to...
Read more >
Microservices | NestJS - A progressive Node.js framework
Nest abstracts the implementation details of each transporter behind a canonical interface for both request-response and event-based messaging. This makes it ...
Read more >
Creating an Event-Based NestJS Microservice
We can now create an event handler for handling a particular event. Considering that our service is interested when a new book is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found