I'm trying to unit test an application which publishes/consumes messages using the Disruptor ring buffer. In the test I would like to
- Configure the Disruptor and it's EventHandlers
- Publish messages onto the ring buffer
- Wait for all messages to be consumed by all EventHandlers
- Perform some assertions
Is there a simple way that I can wait for the messages to be consumed (step 3 above)?
I ended up solving this with a loop which completes when
RingBuffer.remainingCapacity()is equal toDisruptor.getBufferSize()