module 15: implementing messaging patterns. overview lesson 1: creating adaptable orchestration...

22
Module 15: Implementing Messaging Patterns

Upload: rosalyn-bridges

Post on 25-Dec-2015

218 views

Category:

Documents


1 download

TRANSCRIPT

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

Assigning Ports to Trading Partners

Demonstration: Configuring Dynamic Ports

Dynamic Binding Options

Configuring Port Properties at Runtime

Dynamic BindingDynamic Binding

Orchestration code sets the port address at runtime

Address includes prefix which indicates the adapter and address (e.g. FTP://somehost:21/drop)

Orchestration code sets the port address at runtime

Address 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 password

Configuration data for pipeline components

All properties depend on the adapter being used

Other information can be dynamically set in the contextUser name and password

Configuration data for pipeline components

All properties depend on the adapter being used

Direct Binding Options and BenefitsDirect Binding Options and Benefits

Communicating between Orchestrations

Option 1: MessageBox

Orchestration is bound to the MessageBox instead of bound to ports

Provides for loosely coupling orchstrations and systems

Option 1: MessageBox

Orchestration is bound to the MessageBox instead of bound to ports

Provides for loosely coupling orchstrations and systems

Option 2: Self Correlating

Relies on a shared port instance

Useful for receiving messages back from a related process

Option 2: Self Correlating

Relies on a shared port instance

Useful for receiving messages back from a related process

Option 3: Shared Port

Allows for starting a partner orchestration with a message

Option 3: Shared Port

Allows for starting a partner orchestration with a message

Provides a means to pass messages between orchestrations

Three options for implementation

Provides a means to pass messages between orchestrations

Three options for implementation

Direct Binding with the Message Box

MessageBox

Sending Orchestration

Receiving Orchestration

Direct bound receiver creates subscriptions based on filters

Direct bound receiver creates subscriptions based on filters

11

Direct bound send is published in the message box and routed

Direct bound send is published in the message box and routed

22

Orchestration is bound to MessageBox instead of to portsOrchestration 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

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

PortPort

Caller passes an instance of a port into another orchestration

Caller passes an instance of a port into another orchestration

11

Orchestration responds by sending messages to the port instance

Orchestration responds by sending messages to the port instance

22

Ports rely on a shared instancePorts 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

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

PortPort

Direct Binding with Shared Ports

Ordering Orchestration

Shipping Port

Shipping Port

Shipping Orchestration

Allows for starting partner orchestration with a messageAllows 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

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

Shipper SpeedyExpress

Port

Assigning Ports to Trading Partners

Partner SendPortFedShip Ship_FederalShippingSpeedEx Ship_SpeedyExpressUnitedPkg Ship_UnitedPackage

Ordering Orchestration

ShipperRoleShipperRole

Set party on role linkSet party on role link11

Look up partyLook up party22

Send the messageSend the message44

Role LinksRole 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)

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 portGet party bound port33

Choosing Partners for Role Links

Party identifiers or aliases are used to determine the partnerParty identifiers or aliases are used to determine the partner

Send PortsSet the DestinationParty property on the role link in orchestration

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

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”);

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

Dynamic AddressingYou will set the address and/or transport dynamically at runtime

MessageBoxYou want the loose coupling of publish and subscribe

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 them

You can determine at runtime the current “partner” in the process

Role LinksYou are creating a reusable process used with several “partners”

You can define the parties and configure identifiers for them

You can determine at runtime the current “partner” in the process

Self Correlating PortsYou don’t have a common property to correlate on

You are calling the orchestration and can pass the port as a param

Self Correlating PortsYou don’t have a common property to correlate on

You are calling the orchestration and can pass the port as a param

Shared PortsYou want to subscribe to messages from an orchestration

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 Binding

Configure a Role Link

Lesson 2: Receiving Multiple Related Messages

How Correlation Works

Orchestration Subscriptions

Convoy Messaging Patterns

Sequential Convoys

Parallel Convoys

Demonstration: Implementing Convoy Patterns

How Correlation Works

MessageBox

Orchestration Instance

Send

Send

Rcv Rcv

Orchestration Instance

Rcv Rcv

Send

Send

Property Name Value

OrderID 7

Property Name Value

OrderID 5

OrderID = 5

OrderID = 7

Orchestration Subscriptions

Types of Orchestration SubscriptionsTypes of Orchestration Subscriptions

Activation Subscriptions

New instance of the orchestration is created when a message is received

Subscription created when an orchestration is enlisted

Activation Subscriptions

New instance of the orchestration is created when a message is received

Subscription created when an orchestration is enlisted

Instance Subscriptions

Includes receives in called orchestrations

Created at runtime when a correlation set is initialized

Includes an instance ID for the current orchestration instance

New messages routed to the existing orchestration instance

Instance Subscriptions

Includes receives in called orchestrations

Created at runtime when a correlation set is initialized

Includes an instance ID for the current orchestration instance

New messages routed to the existing orchestration instance

Activation Subscriptions are created for activating receive shapes

Instance Subscriptions are created for receive shapes that are following a correlation set

Activation Subscriptions are created for activating receive shapes

Instance Subscriptions are created for receive shapes that are following a correlation set

Convoy Messaging Patterns

Special Types of Messaging Patterns Using CorrelationSpecial Types of Messaging Patterns Using Correlation

Convoys are used to address race conditions in messaging

Convoys setup instance subscriptions

At routing, convoy information is used to correlate messages

Two types: Sequential and Parallel

Convoys are used to address race conditions in messaging

Convoys setup instance subscriptions

At routing, convoy information is used to correlate messages

Two types: Sequential and Parallel

Sequential Convoys

Used When Related Messages Are Received in a SeriesUsed When Related Messages Are Received in a Series

Uniform Sequential Convoy

All messages are of the same type

Uniform Sequential Convoy

All messages are of the same type

Non-Uniform Sequential Convoy

Involve different message types

Non-Uniform Sequential Convoy

Involve different message types

Process messages in a loop until known stop condition

Messages must be received from the same port

Process messages in a loop until known stop condition

Messages must be received from the same port

Implementing Sequential Convoys

Determine how many messages to process

Determine how many messages to process

33

Initialize correlation setInitialize correlation set11

Follow correlation setFollow correlation set22

Parallel Convoys

Used When Related Messages Arrive in an Unknown OrderUsed When Related Messages Arrive in an Unknown Order

Any message can be received first

Must know at design time how many messages are coming

Messages can be received from multiple ports

Messages may be of different types

The Parallel Actions shape is designed to implement parallel convoys

Processing continues once all the messages have arrived

Any message can be received first

Must know at design time how many messages are coming

Messages can be received from multiple ports

Messages may be of different types

The Parallel Actions shape is designed to implement parallel convoys

Processing continues once all the messages have arrived

Implementing Parallel Convoys

Activate = true for each Receive shape within the Parallel Action shapeActivate = true for each Receive shape within the Parallel Action shape

Initialize correlation setInitialize correlation set11

Initialize SAME correlation setInitialize SAME correlation set22

Process continues after all messages are received

Process continues after all messages are received

33

Demonstration: Implementing Convoy Patterns

In this demonstration, you will see how to:

Create a Non-Uniform Sequential Convoy

Create a Parallel Convoy

Lab: Implementing Dynamic Messaging Patterns

Exercise 1: Using Correlation

Exercise 2: Using Role Links

Exercise 3: Defining Parties

Exercise 4: Using Direct Messaging Ports