How to add/remove event handlers after disruptor start?

547 views
Skip to first unread message

Nirman Gupta

unread,
Jun 23, 2015, 4:21:41 PM6/23/15
to lmax-di...@googlegroups.com
Hi,

Is there a way to add new event handlers to disruptor after calling start, possibly at the highest available sequence?
Also, how can an event handler be removed from a disruptor?

Thanks 


Michael Barker

unread,
Jun 24, 2015, 4:56:06 PM6/24/15
to lmax-di...@googlegroups.com
Hi Nirman,

You can do this, but it is not in the Disruptor DSL, you will need to use the RingBuffer and EventProcessors directly.  The key behaviour is that it is necessary to add and remove the gating sequences for the processors that you want to start/stop.  There is an example here: https://github.com/LMAX-Exchange/disruptor/blob/master/src/test/java/com/lmax/disruptor/example/DynamiclyAddHandler.java

The important part is on add you add the gating sequence, then start your new batch processor - in that order.  For removal, you stop the processor, wait for it to shutdown, then remove the gating sequence - again in that order.  The example above demonstrates how to halt and wait for a processor to shutdown.

Mike.  


--
You received this message because you are subscribed to the Google Groups "Disruptor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lmax-disrupto...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages