A dumb question maybe, if I have more segments configured than the total number of threads across all nodes, I would think the events assigned to those unclaimed segments are never processed, correct? I am getting paranoid and want to confirm with you guys. Thanks.
You are correct they will not be processed. You have to make sure that you have at least the same number of threads (compering to segments).
Thanks for the reply. I configured 4 segments, and I have defined 2 thread counts in my java code. But I have 2 instances running. So I would assume that one instance spawns two threads claiming segment 0 and 1, the other instance’s two threads claim segment 2 and 3. However I debugged axon source code, all I am seeing is that both instances come up and WorkerLauncher.start() happen, they do the same logic, i.e claiming segment 0 and 1 for the two threads on each instance. There is no coordination between these two instances. Did I miss anything? Where in the axon code that it is doing the checking to assign 2 and 3 instead of 0 and 1?
Where do you keep the token store? If you have H2 in-memory database per app instance then you will have two token stores which is not good.
Make sure you have one DB instance that is shared between these two app instances.
And, yes. 2 instances x 2 threads = 4 threads in total. These 4 threads should manage 4 segments. Please mind, that if for some reason one instance of your app is down you will have only two threads and there will be no one to process the other two segments. This can be avoided by configuring initially 4 segments and 4 threads per instance. It is better to have more threads then to be in a situation not to have them enough.
Thanks Ivan for the reply. I figured out the issue. I was in the middle of debugging and had a long pause and did not the token expiration mechanism. Yes the threads will claim other segments if the other segments were already taken.