I am using a disruptor for some business logic which publishes to another disruptor that handles IO. The events published to the IO disruptor can arrive too fast to construct and validate the IO. Well, that's kind of the point...
The IO disruptor is setup like this:
disruptor = new Disruptor<>(factory, RING_SIZE, executor, ProducerType.SINGLE, new BlockingWaitStrategy());
disruptor.handleEventsWith(new Logic(disruptor, io));
Then the Logic event handler is setup like this:
public void onEvent(FixEvent event)
{
quickfix.Message ioMessage = event.message;
quickfix.SessionID receiver = event.session;
Log.debug("message: " + event.message.toString());
SessionID id = new SessionID(receiver.getBeginString(), "MYFX", receiver.getTargetCompID());
Session session = Session.lookupSession(id);
Log.debug("message: " + ioMessage.toString());
session.send (ioMessage);
}
and what's happening is by the time you get to send (ioMessage) there's been a new event which is somehow overwriting the ioMessage, and therefore duplicate messages are being sent out.
What can you suggest?