module 15: implementing messaging patterns
DESCRIPTION
Module 15: Implementing Messaging Patterns. Overview. Lesson 1: Creating Adaptable Orchestration Ports Lesson 2: Receiving Multiple Related Messages. Lesson 1: Creating Adaptable Orchestration Ports. Configuring Port Properties at Runtime Communicating between Orchestrations - PowerPoint PPT PresentationTRANSCRIPT
Module 15:Implementing
Messaging Patterns
Overview
Lesson 1: Creating Adaptable Orchestration PortsLesson 2: Receiving Multiple Related Messages
Lesson 1: Creating Adaptable Orchestration Ports
Configuring Port Properties at RuntimeCommunicating between OrchestrationsAssigning Ports to Trading PartnersDemonstration: Configuring Dynamic PortsDynamic Binding Options
Configuring Port Properties at Runtime
Dynamic Binding
Orchestration code sets the port address at runtimeAddress includes prefix which indicates the adapter and address (e.g. FTP://somehost:21/drop)
Other information can be dynamically set in the contextUser name and passwordConfiguration data for pipeline componentsAll properties depend on the adapter being used
Direct Binding Options and Benefits
Communicating between Orchestrations
Option 1: MessageBoxOrchestration is bound to the MessageBox instead of bound to portsProvides for loosely coupling orchstrations and systems
Option 2: Self CorrelatingRelies on a shared port instanceUseful for receiving messages back from a related process
Option 3: Shared PortAllows for starting a partner orchestration with a message
Provides a means to pass messages between orchestrationsThree options for implementation
Direct Binding with the Message Box
MessageBox
Sending Orchestration
Receiving Orchestration
Direct bound receiver creates subscriptions based on filters
1
Direct bound send is published in the message box and routed
2
Orchestration is bound to MessageBox instead of to ports
Use correlation and message context propertiesNo subscribers results in an exception in the orchestrationOffers the benefits of loosely coupled design
Direct Binding with Self Correlation
Sending Orchestration
Receiving Orchestration
Port
Caller passes an instance of a port into another orchestration
1
Orchestration responds by sending messages to the port instance
2
Ports rely on a shared instance
Useful for receiving messages back from a related processCan be used to send more data/messages to running processBizTalk infrastructure handles the correlation with token
Port
Direct Binding with Shared Ports
Ordering Orchestration
Shipping Port
Shipping Orchestration
Allows for starting partner orchestration with a message
Similar to the Start Orchestration shapeUse single port type and define port in each orchestrationUse the same port to define the binding in both orchestrationsReference can be from sender to receiver or vice versa
??Shipper
SpeedyExpress Port
Assigning Ports to Trading Partners
Partner SendPortFedShip Ship_FederalShippingSpeedEx Ship_SpeedyExpressUnitedPkg Ship_UnitedPackage
Ordering Orchestration
ShipperRole
Set party on role link1
Look up party2
Send the message4
Role Links
Define a process that can apply to multiple partners or servicesContain send and receive port typesMust specify the role link type and role (provider or consumer)
Get party bound port3
Choosing Partners for Role Links
Party identifiers or aliases are used to determine the partner
Send PortsSet the DestinationParty property on the role link in orchestration
Receive PortsParty identification handled in the receive pipeline Any receive port can be used by any partner or application Requires that the receiving host is Authentication Trusted
TradingPartnerRoleLink(Microsoft.XLANGs.DestinationParty) = new Microsoft.XLANGs.BaseTypes.Party(“keyvalue”, “qualifier”);
Dynamic Binding Options
Dynamic AddressingYou will set the address and/or transport dynamically at runtime
MessageBoxYou want the loose coupling of publish and subscribe
Role LinksYou are creating a reusable process used with several “partners”You can define the parties and configure identifiers for themYou can determine at runtime the current “partner” in the process
Self Correlating PortsYou don’t have a common property to correlate onYou are calling the orchestration and can pass the port as a param
Shared PortsYou want to subscribe to messages from an orchestration
Demonstration: Configuring Dynamic Ports
In this demonstration, you will see how to:Configure a Port using Dynamic BindingConfigure a Role Link
Lesson 2: Receiving Multiple Related Messages
How Correlation WorksOrchestration SubscriptionsConvoy Messaging PatternsSequential ConvoysParallel ConvoysDemonstration: Implementing Convoy Patterns
How Correlation Works
MessageBox
Orchestration Instance
Send
Rcv
Orchestration Instance
Rcv
Send
Property Name ValueOrderID 7
Property Name ValueOrderID 5
OrderID = 5
OrderID = 7
Orchestration Subscriptions
Types of Orchestration Subscriptions
Activation SubscriptionsNew instance of the orchestration is created when a message is receivedSubscription created when an orchestration is enlisted
Instance SubscriptionsIncludes receives in called orchestrationsCreated at runtime when a correlation set is initializedIncludes an instance ID for the current orchestration instanceNew messages routed to the existing orchestration instance
Activation Subscriptions are created for activating receive shapesInstance Subscriptions are created for receive shapes that are following a correlation set
Convoy Messaging Patterns
Special Types of Messaging Patterns Using Correlation
Convoys are used to address race conditions in messagingConvoys setup instance subscriptionsAt routing, convoy information is used to correlate messagesTwo types: Sequential and Parallel
Sequential Convoys
Used When Related Messages Are Received in a Series
Uniform Sequential ConvoyAll messages are of the same type
Non-Uniform Sequential ConvoyInvolve different message types
Process messages in a loop until known stop conditionMessages must be received from the same port
Implementing Sequential Convoys
Determine how many messages to process
3
Initialize correlation set1
Follow correlation set2
Parallel Convoys
Used When Related Messages Arrive in an Unknown Order
Any message can be received firstMust know at design time how many messages are comingMessages can be received from multiple portsMessages may be of different typesThe Parallel Actions shape is designed to implement parallel convoysProcessing continues once all the messages have arrived
Implementing Parallel Convoys
Activate = true for each Receive shape within the Parallel Action shape
Initialize correlation set1
Initialize SAME correlation set2
Process continues after all messages are received
3
Demonstration: Implementing Convoy Patterns
In this demonstration, you will see how to:Create a Non-Uniform Sequential ConvoyCreate a Parallel Convoy
Lab: Implementing Dynamic Messaging Patterns
Exercise 1: Using CorrelationExercise 2: Using Role LinksExercise 3: Defining PartiesExercise 4: Using Direct Messaging Ports