Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
395 views
in Technique[技术] by (71.8m points)

axon - What is a ProcessingGroup (@ProcessingGroup)?

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 To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

welcome! Let me go through your doubts and try to help you :)

  • What is a Processing Group?

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.

  • What is a Processing Group used for?

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.

  • What about your problem?

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...