Name

Content-Based Routing Pattern

Goal

Provide a single point of receipt for messages associated with a particular use case, even if the use case will be handled by different backend systems depending on the content of the request (Figure C-3).

Content-based routing
Figure C-3. Content-based routing

Participants

Sender

Sends the message to the router.

Message

Contains the content.

Content router

Examines the content and determines which handler should be used.

Handlers

Process the message.

Interactions

The sender sends a message to the router. The router examines the message content and determines which handler should be used to process it. This check may be assisted by an external resource, such as a directory server. The router then dispatches the message to the appropriate handler.

Get J2EE Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.