wso2-dev/andes — pull request #211 by Asitha (2014-12-11 05:54:09+00:00)
Title: Disruptor based inbound event handling implementation

- Introduced Andes class for all Andes related interactions from outside. This works as a facade
for MessagingEngine SubscriptionManager and AndesContextInformationManager

- All the events coming to Andes are directed to a Disruptor ringBuffer. And then handled by relevant
Event handlers and directed to relevant entity within Andes. ( e.g.: MessagingEngine,
SubscriptionManager)

- Introduced AndesMessage class to wrap AndesMessageMetadata and AndesMessagePart. Andes only
accept AndesMessages when receiving messages. No separate methods to handle message parts and
message meta data at Andes level. This is to avoid unwanted complexity in handling a message as two
separated entities.

- Disruptor has four event handlers types to handle events.
- MessagePreProcessor:
This event handler goes through the ring buffer first. Updates the message routing information if
necessary. Specially for topics if message cloning needed clones the messages and Updated the
AndesMessage list in the same position in ring buffer.

- ConcurrentMessageWriter:
There are multiple message writers that goes through the ring buffer after message pre processor
This writes messages to the data base. All the necessary information is updated by message pre
processor.

- AckHandler:
Acknowledgement related database update and state changes handle by this. There are multiple ack
handlers that run in parallel after the MessagePreProcessor. ConcurrentMessageWriters and
AckHandlers run in parallel.

- StateEventHandler:
All the Andes state changes related logic, except for the acknowledgement handling logic, is handled
through this event handler. e.g.: slot update logic for incoming new messages, channel open event
This even handler goes through the list after all the event handlers have processed a slot in
ring buffer.