Following diagrams are my understanding of the ServiceMix architecture based on a study of the source code. Enjoy – PS.
NMR Flow types
The flow type determines the mechanism by which the Normalized Message Router (NMR) Broker sends messages from one BC/SE to another.
insert-flow-class-diagram
- JBIContainer "flowName" attribute determines the flow type used
- There is only 1 flow per Broker (and 1 Broker per JBIContainer)
- Flow name/class mappings are in the ServiceMix JAR. See META-INF/services/org/servicemix/jbi/nmr/flow
- There are a number of flow implementations. For example: STFlow, SedaFlow, JMSFlow, JCAFlow
insert-routing-overview
- The NMR Broker calls sendExchangePacket to deliver a message
- The flow implementation of abstract doSend Method determines how the message sending mechanism works
The various NMR flow implementations are described below
STFlow
STFlow = "Straight Through" Flow. This is the simplest mechanism. There is no staging or buffering.
insert-stflow-diagram
SedaFlow
SEDA = "Staged Event Driven Architecture" Flow. SEDA decomposes a complex, event-driven application into a set of stages connected by queues.
insert-seda-class-diagram
- There is 1 SedaFlow instance and a number of SedaQueue instances (1 per component)
- The SedaQueue holds a concurrent HashMap of MessageExchanges (MEs).
- The SedaFlow "enqueues" an ME to send a message
- The SedaQueue instance "dequeues" the ME and processes it
insert-seda-sequence-diagram
- SedaQueue instances are lazilly created as needed and referenced in a queueMap
- Each SedaQueue instance runs as JCA1.5 asynchronous Work thread polling the HashMap at fixed intervals
- Having enqueued the ME, the SedaFlow doSend Method may return
- When the SedaQueue Worker (run Method) finds (dequeues) an ME, it processes it in another JCA Worker thread created solely for that purpose
JMSFlow
todo