On an ESB like Apache Camel, what mechanism is actually “marching” (pulling/pushing) messages along the routes from endpoint to endpoint?
Does the Camel RouteBuilder just compose a graph of Endpoints and Routes and know which destination/next Endpoint to pass a message to after it visits a certain Endpoint or do the Endpoints themselves know which is the next destination for the message it has processed.
Either way, I’m confused:
- If it is the
RouteBuilderthat knows the “flow” of messages through the system, then thisRouteBuilderwould need to know the business logic of when toEndpoint Ashould pass the message next toEndpoint BvsEndpoint C, but in all the Camel examples I see this business logic doesn’t exist; and - It seems to be that putting that kind of “flow” business logic in the
Endpointsthemselves couples them together and defeats some of the basic principles of SOA/ESB/EIP, etc.
Under the hood I believe camel is constructing a pure graph where each node is a Camel endpoint/processor, and each edge is a route between two endpoints (a source and a destination). This graph is precisely what
RouteBuilderis building when you invoke its API. When you go tostart()a Camel route, the graph is most likely validated and translated into a series ofRunnables that need to be executed, and probably uses some kind of customExecutoror thread management to handle theseRunnables.Thus, the execution of the
Runnables (processors processing messages as they arrive) are handled by this customExecutor. This is the mechanism that “marches messages along”, although the order in which the tasks are queued up is driven by the overarching structure of the graph composed byRouteBuilder.