I'm trying to choose an appropriate architecture for a middle-frequency trading system I'm working on. Currently, I receive messages from Web Socket or Rest and process them right there. Sometimes it includes IO operations (i. e. additional rest requests), so it works very slowly and all other messages, I suppose, are getting buffered in Web Socket client's implementation. This naive approach doesn't look very scalable.
I've been reading into mature architectures for handling trading messages and currently, my choice has been narrowed down to Disruptor and Reactive programming. I would like to ask for your advice which one is a better choice. Specifically, I'm concerned about 2 scenarios:
- Logical dependency between message handlers. When I'm connected to a specific exchange, I need to receive balances and open orders before I can be able to process trading messages and make orders based on them. It seems to me Reactive is a better approach to handle this kind of situations that require flow control. Is it a problem for Disruptor?
- Long-running message handlers. Message handlers should be as fast as possible (not to block the following messages) but what is the right approach in case I need to make, let's say, a rest request to create an order as part of message handler?