concept domain logic in category esb

appears as: domain logic, The domain logic
Open-Source ESBs in Action: Example Implementations in Mule and ServiceMix

This is an excerpt from Manning's book Open-Source ESBs in Action: Example Implementations in Mule and ServiceMix.

Another way to determine the ultimate destination for an incoming message is by looking at the content of that message. The content-based router interprets the incoming message against particular element values and forwards this message to the matching target endpoint. There are two main types of content-based routers, which differ as to where the ultimate destination is determined. The first type is the content-based router with domain logic, and the second is the router without domain logic.

For the first type of content-based router, the ultimate destination is determined in the ESB. The source application sends a message to the ESB, which consumes the message. The message is picked up by the content-based router, which reads message values based on predefined routing rules. For an insurance request, here’s a sample routing rule: if the insurance type is car, the message is forwarded to the car insurance application. The content-based router will extract the insurance type from the incoming insurance request and fire the routing rule against the extracted value. The logic for determining the ultimate destination is therefore performed within the content-based router. The router needs to be configured with domain logic to determine the destination of an incoming message.

The other type of content-based router is ignorant of any domain logic. The source application itself determines the ultimate destination for the message that’s waiting to be sent. The domain logic needed to execute this logic is then only required within the source applications. The message is enriched with a message header that contains the target destination and is then passed on to the ESB. The content-based router extracts the message header and sends the message to the destination as defined in this header value. The message header value typically isn’t an endpoint definition that can be used directly to forward a message. In most cases, the message header contains some text value configured in the content-based router to represent a specific endpoint definition.

The content-based router with domain logic is the most common implementation. We’ll look at an example with ServiceMix and Mule using this router. We’ll show the other type of content-based router with an example using Apache Synapse.

Figure 5.4. Example of content-based routing without domain logic using the WS-Addressing Action header element. The WS-Addressing Action header value defines a keyword that can be used to select the target endpoint for the insurance request message.