Partner Direct Port is one of the BizTalk hidden gems. It opens simple ways to the several messaging patterns.
This article based on the Kevin Lam’s blog article. The article is pretty detailed but it still leaves several unclear pieces. So I have created a sample and will show how it works from different perspectives. (The original article was on my blog. The source code is it the MSDN Gallery.)
Let's imagine these requirements:
It is interesting but all orchestrations use only one port type.
It is possible because all ports are one-way ports and use only one operation.
I have added a B orchestration. It helps to test the sample, showing all test messages in channel.
The Receive shape Filter is empty. A Receive Port (R_Shema1Direct) is a plain Direct Port. As you can see, a subscription expression of this direct port has only one part, the MessageType for our test schema: A Filer is empty but, as you know, a link from the Receive shape to the Port creates this MessageType expression.
I use only one Physical Receive File port to send a message to all processes.
Each orchestration outputs a Trace.WriteLine(“<Orchestration Name>”).
This sample has three orchestrations: A_1, A_21 and A_22.
A_1 is a sender, A_21 and A_22 are receivers.
Here is a subscription of the A_1 orchestration:
It has two parts
As you can see the Partner Orchestration parameter for the sender and receiver orchestrations is the same.
I dropped a test file in a file folder. There we go:
Let’s look at a context of a message sent by A_1 on the second step:
Now let’s see a subscription of the A_21 and A_22 orchestrations.
Now it makes sense. That’s why we have chosen such a strange value for the Partner Orchestration parameter of the sending orchestration.
This sample has three orchestrations: A_11, A_12 and A_2.
A_11 and A_12 are senders, A_2 is receiver.
Let’s see what was a context of a message sent by A_1 on the second step:
Here is a subscription of the A_2 orchestration.
I had a hard time trying to explain the Partner Direct Ports in simple terms. I have finished with this model:
Receivers know a Sender. Sender doesn’t know Receivers. Publishers know a Subscriber. Subscriber doesn’t know Publishers. 1 –> 1 1 –> M
Senders know a Receiver. Receiver doesn’t know Senders. Subscribers know a Publisher. Publisher doesn’t know Subscribers. 1 –> 1 M –> 1
It’s worth to note, the Partner Direct Port Binding creates a chain opened from one side and closed from another.