Reputation: 69
I have following questions regarding the disruptor:
c1 P1 - c2 - c4 - c5 c3
Where c1 to c3 can work in parallel after p1, and C4 and C5 work after them.
So conventionally I'd have something like this (with P1 and C1-C5 being runnables/callables)
p1.start();
p1.join();
c1.start();
c2.start();
c3.start();
c1.join();
c2.join();
c3.join();
c4.start();
c4.join();
c5.start();
c5.join();
But in case of the Disruptor none of my event handlers implement Runnable or Callable, so how'd the disruptor framework end up running them in parallel?
Take following sceanrio:
My consumer C2 requires to make a webservice call for some annotation to the Event, In SEDA I can startup 10 threads for such 10 C2 requests [for pulling the message out of queue + make Webservice Call and update the next SEDA Queue] and that will make sure that I don't sequentially wait for a web service response for each of the 10 requests where as in this case my eventprocessor C2 (if) being the single instance would wait sequentially for 10 C2 requests.
Upvotes: 2
Views: 5797
Reputation: 83
Disruptor default strategy is multi-threaded, so if every of your processors are working in a different Handler (Consumer), so it should be fine, and your processors are multi-threaded.
Upvotes: 0
Reputation: 969
Your EventHandler is composed into an instance of a BatchEventProcessor, which is a Runnable.
When using the DSL, the Disruptor takes care of creating these threads via an Executor instance.
With respect to your specific scenario (ie: long running event handlers), you might refer to this question:
Upvotes: 5