routing message interaction patterns - reference ... · dynamic routing message filter scatter...

Post on 22-Jul-2020

4 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

Routing Message Interaction Patterns - Reference

Implementation With Oracle Service Bus (OSB11g)

2

Summary The document covers the Routing Message Interaction Patterns with the reference implementation in

OSB11g.

The Message Interaction patterns can be classified into

Integration Styles

Messaging Systems

Messaging Channels

Message Router

Message Construction

Message Transformation

Messaging Endpoints

System Management

Following tables provides the snapshot of the different routing patterns and their nature of support in

OSB11g

Directly Supported Patterns in OSB11g Message Broker

Pipes & Filters

Message Router

Content Based Router

Dynamic Routing

Message Filter

Scatter Gather

Splitter

Composed Message Processor

Indirect Support Recipient List

Routing Slip

Re-Sequencer

Aggregator

Process Manager

Message Router Consumes a Message from one Message Channel and republishes it to a different Message Channel

depending on a set of conditions.

Classification Conditional Routing

Operational Routing

Content Based Routing

Header Based Routing

3

References http://www.eaipatterns.com/toc.html

Oracle Service Bus developers guide

4

Message Interaction Patterns – Implementation in OSB

Contents Summary ....................................................................................................................................................... 2

Message Router ............................................................................................................................................ 2

Classification ............................................................................................................................................. 2

References .................................................................................................................................................... 3

Message Interaction Patterns – Implementation in OSB ............................................................................. 4

1 Pattern – Pipes & Filters........................................................................................................................ 6

1.1 Description: ................................................................................................................................... 6

1.2 Implementation ............................................................................................................................ 6

1.3 Alternate Approach ....................................................................................................................... 6

2 Pattern – Content Based Routing ......................................................................................................... 7

2.1 Description .................................................................................................................................... 7

2.2 Implementation ............................................................................................................................ 7

2.3 Alternate Approach ....................................................................................................................... 7

3 Pattern - Dynamic Routing .................................................................................................................... 8

3.1 Description .................................................................................................................................... 8

3.2 Implementation ............................................................................................................................ 8

3.3 Alternate Approach ....................................................................................................................... 9

4 Pattern - Message Filter ...................................................................................................................... 10

4.1 Description .................................................................................................................................. 10

4.2 Implementation .......................................................................................................................... 10

5 Pattern - Recipient List ........................................................................................................................ 12

5.1 Description .................................................................................................................................. 12

5.2 Implementation .......................................................................................................................... 12

6 Pattern - Splitter .................................................................................................................................. 14

6.1 Description .................................................................................................................................. 14

6.2 Implementation .......................................................................................................................... 14

7 Pattern - Resequencer ........................................................................................................................ 16

7.1 Description .................................................................................................................................. 16

7.2 Assumption ................................................................................................................................. 16

7.3 Implementation .......................................................................................................................... 16

5

8 Pattern - Aggregator ........................................................................................................................... 17

8.1 Description .................................................................................................................................. 17

8.2 Implementation .......................................................................................................................... 17

9 Pattern - Composed Message Processor ............................................................................................ 18

9.1 Description .................................................................................................................................. 18

9.2 Implementation .......................................................................................................................... 18

10 Pattern - Scatter Gather .................................................................................................................. 19

10.1 Description .................................................................................................................................. 19

10.2 Implementation .......................................................................................................................... 19

11 Pattern - Routing Slip ...................................................................................................................... 20

11.1 Description .................................................................................................................................. 20

11.2 Assumption ................................................................................................................................. 20

11.3 Implementation .......................................................................................................................... 20

12 Pattern – Process Manager ............................................................................................................. 22

12.1 Description .................................................................................................................................. 22

12.2 Difference from the Routing Slip ................................................................................................ 22

12.3 Implementation .......................................................................................................................... 22

13 Pattern - Message Broker ............................................................................................................... 24

13.1 Description .................................................................................................................................. 24

6

1 Pattern – Pipes & Filters

1.1 Description: Divide a larger processing task into a sequence of smaller, independent processing steps (Filters) that

are connected by channels (Pipes)

1.2 Implementation OSB Constructs Used: Pipeline, Stage

Drag the Pipeline Node to the Message Flow

Add the stage to the Pipeline (Each Stage represents the filter)

Multiple stages can be added into the pipeline , connected by Pipes

1.3 Alternate Approach Pipeline Pair acts as the filter

Filter

Pipe

Pipeline Pair

7

Proxy Service acts as the filter

2 Pattern – Content Based Routing

2.1 Description To route each message to the correct recipient based on message content. The routing can be based on

a number of criteria such as existence of fields, specific field values in the message body.

2.2 Implementation OSB Constructs Used: Conditional Branch

Add Conditional Branch to the Message Flow

Add the desired number of branches ; and specify the routing condition for each

o The route/branch is determined by condition imposed on the payload(body)

2.3 Alternate Approach If-else

Routing Table

8

3 Pattern - Dynamic Routing

3.1 Description Router that can self-configure based on special configuration messages from participating destinations.

In more sophisticated integration scenarios, the Content-Based Router can take on the form of a

configurable rules engine that computes the destination channel based on a set of configurable rules

3.2 Implementation OSB Constructs Used: Route Node, Dynamic Routing

Add Route Node to the Message Flow

Drag the Dynamic Routing to the Route Node

o Specify the Routing Expression

9

3.3 Alternate Approach Dynamic Publish

10

4 Pattern - Message Filter

4.1 Description To eliminate undesired messages from a channel based on a set of criteria

4.2 Implementation The Message filter pattern can be worked at various levels like

Type Description

Entry level The messages that conform to a particular schema are picked

Processing level All the messages are polled but only the relevant ones are processed

Message Selector While using the JMS protocol ; message selector can also be used as a filter mechanism

Entry level – determine the message type/format at entry level of the Proxy Service

o Message type Proxy Service with fixed XSD/MFL

Processing level – determine the message format at the message flow level of the Proxy Service

o Use if-else construct to determine and process the desired message

11

12

5 Pattern - Recipient List

5.1 Description Define a channel for each recipient. Then use a Recipient List to inspect an incoming message,

determine the list of desired recipients, and forward the message to all channels associated with the

recipients in the list.

5.2 Implementation OSB Constructs Used: Service Callout & Dynamic Routing

Use Base Proxy Service to determine the recipient(s)

o Use a mapping file to maintain the recipient(s) list and the routing condition

Use Service Callout to invoke the Router Proxy ( the number of invocations of the router proxy

depends upon the number of targets in the list)

Router Proxy Service uses dynamic routing to route to the end services(Proxy / Business)

Base Proxy Service Configuration – Service Callout inside the for – each construct

13

Router Proxy Service Configuration –Dynamic Route

14

6 Pattern - Splitter

6.1 Description Use a Splitter to break out the composite message into a series of individual messages, each containing

data related to one item.

6.2 Implementation OSB Construct used : Split Join ( supports WSDL based invocation of services or java callouts)

o Base WSDL has only input associated with the operation

<wsdl:binding name="assetBinding" type="tns:assetPort">

<soap:binding style="document"

transport="http://schemas.xmlsoap.org/soap/http" />

<wsdl:operation name="getAssetInfo">

<soap:operation soapAction="" />

<wsdl:input>

<soap:body use="literal" />

</wsdl:input>

</wsdl:operation>

</wsdl:binding>

15

16

7 Pattern - Resequencer

7.1 Description Use a stateful filter, a Resequencer, to collect and re-order messages so that they can be published to

the output channel in a specified order.

7.2 Assumption Message contains the following identifiers

Group Id : Specifies the group for a particular message

Total Count : Specifies the total number of messages in the group

Sequence Id: Specifies the sequence of the message in the group

7.3 Implementation Use a poll based(file) proxy service to persist the message/ file reference into the database

o Maintain two tables in the database

Table Description

GroupDetails Maintains the list of group and the total messages associated with that group

GroupId

TotalCount This table is populated once per group.

MessageDetails Stores the information pertaining to a message

GroupId

SequenceId

Message/File Reference

Stored Procedure to populate the tables and provide the message / file reference when the total

count for a group in GroupDetails matches the message count in message details

Use java callout to read the messages/file and dump into another location

17

8 Pattern - Aggregator

8.1 Description Use a stateful filter, an Aggregator, to collect and store individual messages until a complete set of

related messages has been received. Then, the Aggregator publishes a single message distilled from the

individual messages.

8.2 Implementation The implementation is the extension of the re-sequencer with a difference that in re-sequencer

the messages are not necessarily joined into a single message but in aggregator the messages

are joined into a single message and validated

18

9 Pattern - Composed Message Processor

9.1 Description Use Composed Message Processor to process a composite message. The Composed Message Processor

splits the message up, routes the sub-messages to the appropriate destinations and re-aggregates the

responses back into a single message

9.2 Implementation OSB Construct used : Split Join ( supports WSDL based invocation of services or java callouts)

19

10 Pattern - Scatter Gather

10.1 Description Use a Scatter-Gather that broadcasts a message to multiple recipients and re-aggregates the responses

back into a single message.

10.2 Implementation OSB Construct used : Split Join ( supports WSDL based invocation of services or java callouts)

20

11 Pattern - Routing Slip

11.1 Description Attach a Routing Slip to each message, specifying the sequence of processing steps. Wrap each

component with a special message router that reads the Routing Slip and routes the message to the

next component in the list.

11.2 Assumption Process step is identified by a Proxy Service and not by Action/Stage/Pipeline

Proxy Services/Processing steps have a dynamic routing instead of static

A dummy proxy (with simple root node) is invoked as the last processing step – since each proxy

service has a dynamic route configured; it becomes necessary to have an end configured to the

processing steps. The dummy proxy acts as the last processing step

11.3 Implementation Extension of Recipient List

Use a mapping file to determine the list of recipients and attach the list to the header

Inspect the header and sends the message to the first recipient in the list

Each recipient/processing step deletes the first header element, processes and passes the

request to the next step(dynamic invocation)

21

22

12 Pattern – Process Manager

12.1 Description Use a central processing unit, a Process Manager, to maintain the state of the sequence and determine

the next processing step based on intermediate results.

12.2 Difference from the Routing Slip In Routing Slip the list of processing steps is determined before the first processing step whereas in

Process Manager the processing step is determined from result from the response of the processing

step.

Business Rules Engine may be used when the routing rules are complex in nature.

12.3 Implementation Use of Split Join and dynamic routing

Processing Step refers to Proxy Service

The processing steps are maintained in the mapping file

Each processing step sends the response to the Processing Manager; to determine the next processing

step

The pre-processing steps determine the end point of the service to be invoked

23

Dynamic Route Configuration: Makes use of Service callout (Until the exit condition is reached)

24

13 Pattern - Message Broker

13.1 Description Use a central Message Broker that can receive messages from multiple destinations, determine the

correct destination and route the message to the correct channel.

Implement the internals of the Message Broker using the design patterns presented in this document

top related