AggregateIdentifier for the command being currently processed is identified:
Object aggregateIdentifier = commandTargetResolver.resolveTarget(command).getIdentifier();
InvokerSegment is assigned based on the consistent hash of aggregateId:
invokerSegment = idHash % commandHandlerInvokers.length;
DisruptorCommandBus pulls next available sequence from the ring buffer:
long sequence = ringBuffer.next();
Based on the current sequence DisruptorCommandBus fetches the instance of CommandHandlingEntry from RingBuffer.
CommandHandlingEntry event = ringBuffer.get(sequence);
CommandHandlingEntry will then be initialized with current context data.
DisruptorCommandBus publishes the sequence to ring buffer, making CommandHandlingEntry available to be consumed.
ringBuffer.publish(sequence);
and then delegates it to all instances of CommandHandlerInvoker
eventHandler.onEvent(event, nextSequence, nextSequence == availableSequence);
LMax BatchEventProcessor fetches next available sequence from the RingBuffer
long nextSequence = sequence.get() + 1L;
and then delegates it to all consumers - in this case all instances of CommandHandlerInvoker
eventHandler.onEvent(event, nextSequence, nextSequence == availableSequence);