Disruptor – Last handler not invoked

115 Views Asked by At

I'm playing with Disruptor from Scala, and there is a strange issue: the last handler in chain (no matter which handler it is or how long the chain is) isn't invoked. Here's what I'm doing:

val handlers = Seq(handler1, handler2, handler3)
val firstHandler = input.disruptor.handleEventsWith(handlers.head)
handlers.tail.foldLeft[EventHandlerGroup[IntMessage]](firstHandler) {
  (prev,handler) =>
  prev.then(handler) 
}

In debugger I can see that the last handler is added to consumer repository, but somehow onEvent is never invoked. I'm using a CachedThreadPool executor.

How can I make this work?

1

There are 1 best solutions below

0
On

I'm not a scala expert but the event will not be visible to the downstream handlers untill the head handler exposes the fact it has processed the event. I.e. updated its sequence number.