Priority of events in ring buffer?

247 views
Skip to first unread message

Dmitry Zagorulkin

unread,
Aug 12, 2019, 9:56:16 AM8/12/19
to Disruptor
Hello,

How to process some messages before others? 
What is the best pattern to achieve this behavior?  

Thanks!

Maksim Zheravin

unread,
Aug 12, 2019, 2:55:23 PM8/12/19
to Disruptor

Hi Dmitry,

Let me share my understanding.
Preserving original messaging sequence is a crucial part of the Disruptor pattern.
It is possible to handle messages in any arbitrary order, you can even reorder them, but only within a single batch scope (between heading sequence barrier and tailing sequence).
If you need something similar to priority queue - this is not possible, unless you have two ring buffers.

Regards,

Dmitry Zagorulkin

unread,
Aug 15, 2019, 4:55:03 AM8/15/19
to Disruptor
Maksim, thanks!

Do you have any example code how to use two ring buffers properly for such task? 


On Monday, August 12, 2019 at 4:56:16 PM UTC+3, Dmitry Zagorulkin wrote:
Reply all
Reply to author
Forward
0 new messages