Implement Design Patterns in Orchestrations
This section discusses the common patterns of BizTalk Server programming as well as enterprise integration patterns. You can leverage a single pattern or combine multiple patterns to design your business process and then implement the design by using shapes in BizTalk Orchestration Designer.
The following entries briefly describe each pattern and point to the topics or samples that show how to implement the patterns using BizTalk Orchestration Designer.
Aggregator is the pattern of receiving information from multiple sources and consolidating it into a single message. For an example of this pattern, see Aggregate.odx in Aggregator (BizTalk Server Sample).
Calling Pipelines from an Orchestration
You can call send and receive pipelines from your orchestrations. This allows the reuse of pipelines and helps maintain the decoupling of an orchestration from the pipeline stages. For an example of this pattern, see Aggregate.odx in Aggregator (BizTalk Server Sample). Another example is CMP.odx in Composed Message Processor (BizTalk Server Sample). See also How to Use Expressions to Execute Pipelines.
Composed Message Processor
Composed Message Processor is the pattern of processing individual items from an aggregated or batched interchange message. For an example of this pattern, see CMP.odx in Composed Message Processor (BizTalk Server Sample).
Content-Based Router is the pattern of determining the recipient of a message based on some part of the message content. For an example of this pattern, see CBRSample (BizTalk Server Sample).
Dynamic Router is the pattern of determining the destination address as well as the transport protocol based on the result of message processing. You can use a dynamic send port or a Role Link shape to implement this pattern. For an example of this pattern, see ReceiveSend.odx in SendMail. Another example is SupplierProcess.odx in PartyResolution (BizTalk Server Sample).
BizTalk Server allows you to designate automated handling of messaging failures as an alternative to the default behavior of placing failed messages in the Suspended queue. You can route failed messages to a subscribing port for reporting or processing. For an example of this pattern, see ResubmitLogic.odx in Error Handling (BizTalk Server Samples Folder).
Exception Handling and Compensation
You can use an exception handler and a Throw Exception shape or an Expression shape for exception handling. For example, you can place the following code in the Expression shape to throw the exception:,
excp = new System.Exception(); throw(excp);
You can use a compensation block and a Compensate shape to perform the compensation on the transactions that have been committed. For an example of this pattern, see UpdateContact.odx in Compensation (BizTalk Server Sample). Another example is in Custom Exceptions.
Message Broker is the pattern of determining the destination of a message and still maintaining control over the message flow. For more, see Processing in the OrderBroker Orchestration.
The Message Filter pattern selects messages meeting particular criteria for processing. You can implement this pattern by adding the filter expression to an activated Receive shape. For more information, see Using Filters With the Receive Message Shape.
The Message Translator pattern converts a message from one form to another form. You can implement this pattern by using a BizTalk map with a Transform shape in an orchestration. For an example of this pattern, see HelloOrchestration.odx in HelloWorld (BizTalk Server Sample).
The Parallel Convoy pattern enables multiple single items to join together to achieve something that an individual item cannot accomplish by itself. The set of related items can arrive in any order, but BizTalk Server must receive all of them before starting the process.
Scatter and Gather
The Scatter and Gather pattern enables messages to be sent to multiple recipients and messages to be received back from each recipient. You can implement this pattern by using the Splitter pattern and the Aggregator pattern. You use the Aggregator pattern to assemble the results from using the Splitter pattern and put them under a Parallel Actions shape.
The Sequential Convoy pattern enables multiple single items to join together to achieve something that an individual item cannot accomplish by itself. A sequential convoy is a set of related items that have a predefined order. Although the items do not have to be exactly the same, BizTalk Server must receive the items in a sequential order.
The Splitter pattern takes a single message and splits it into multiple messages.
Suspend with Retry
The Suspend with Retry pattern enables the orchestration to suspend a message when there is an error. The suspension occurs within a loop so that the orchestration suspends, asks for intervention, and then retries the operation a fixed number of times.