I'm new to Axon Framework and struggling to understand what processing groups are and what they are used for.
If you guys can expand on this, it would be greatly appreciated.
I'm trying to have 2 instances of the same application running on different hosts with a single database (event store). However, I get the error below. The first host works fine but the second doesn't.
Should I assign different processing groups to them?
org.axonframework.eventhandling.tokenstore.UnableToClaimTokenException: Unable to claim token 'projections[0]'. It is owned by '1@xxxxx-yyyyy-zzzzz'
Regards, Carlo
welcome! Let me go through your doubts and try to help you :)
Processing Group is a logical way to group Event Handlers. You can define them on your Event Handling Component using the @ProcessingGroup("processingGroupName")
annotation or, in case you do not provide a name, the default value is the full.package.name
. Keep in mind that a Tracking Event Processor is created for each Processing Group.
As said before, it is very much related to the Tracking Event Processor. In this case, each TEP claims its Tracking Token (in order to avoid multiple processing of the same event in different threads/nodes). You can very much read about it in depth here.
From the shared log and your comments stating you have 2 instances, it just means one instance already claimed that token and the other one can't claim it. If the first one releases it, they will race to claim it, meaning any of them can do it. There are ways to have both processing event in a parallel way and you can better check the docs here and here.
To sum up, there is nothing wrong with this log line and I believe you saw it as an INFO
and not an ERROR
.
Hope to have clarified your doubts about it.