TrackingEventProcessor keeps connecting to the DB to update the token's timestamp

Hello,

I have been trying to use the Tracking Processors but I am not sure that I understanding correctly what is happening in my application.
In essence, I see a thread constantly connecting to the database to refresh the timestamp of the only token (I have one processor) present in the table which causes the application to never stop (it’s a Spring boot app without web server).
I was expecting the tracking processor to start when an event is publish or the application is started and stop itself if there is nothing to do but that’s not what seems to be happening.
Also I don’t understand why it writes constantly (I do understand it needs to check for changes in the token index when it runs).
Can you please help me understand what’s happening?

I don’t know if it’s useful but the use of tracking processors is enabled globally with:
`
@Autowired
public void configure(EventHandlingConfiguration config) {
config.usingTrackingProcessors();
}

`

I also have a single event handle that I see getting called once when the event is dispatched the first time (when the aggregate is created):
`
@Component
public class TestEventHandler {
@EventHandler
private void handle(TestCreatedEvent event) {
System.out.println(“Event handled!”);
}
}

`

I have tried with both event sourced and regular aggregates with the same result.

Thanks in advance for your help :slight_smile:

Hi,

the tracking processor, by default, will keep on tracking until it is stopped. Just like the subscribing processor, which will receive messages as long as it is subscribed.
At the moment, there is no way to detect if a tracking processor has reached the end of a stream (from the outside).

When the tracking processor has reached the end of a stream, it will start polling for new data to become available. In the meantime, it updates its “claim” on the token, to let other nodes (if present) know that this processor is processing that stream (concurrent processing will be supported in upcoming versions). A node will “steal” another node’s token if it hasn’t been updated for 10 seconds (configurable).

FYI: since you’re on the event handling side of things, event sourcing or not will not make a difference. That just defines how aggregates are loaded.

Hope this helps.
Cheers,

Allard

Hi Allard,
It is clear.
Thank you.