我正在寻找使用破坏者 2.10.4。中断器/环形缓冲区是用户定义类中的属性。出于某种原因,在我看来,我的处理程序没有被调用
final EventHandler<Message> handler = new EventHandler<Message>() {
public void onEvent(final UserDefinedMessage event, final long sequence, final boolean endOfBatch) throws Exception {
log.info("Sequence: " + sequence);
log.info("disruptor message: " + event.getValue());
}
};
// disruptor = new Disruptor<UserDefinedMessage>(UserDefinedMessage.EVENT_FACTORY, 1024, exec);
disruptor = new Disruptor<UserDefinedMessage>(UserDefinedMessage.EVENT_FACTORY, exec, new SingleThreadedClaimStrategy(50), new SleepingWaitStrategy());
disruptor.handleEventsWith(handler);
ringBuffer = disruptor.start();
更新:Pilot 错误 - 我不相信消息正在发布到环形缓冲区。