Thursday, June 3, 2010

How To Cluster BizTalk's MSMQ Receive Adapter - Windows 2008 Server

The following screenshots outline the process for clustering BizTalk's MSMQ adapter. We had to do this to insure that we did not have message duplication across our BizTalk nodes. Message duplication can occur when you have specific adapters running in multiple Host Instances. Adapters such as POP3, FTP, MSMQ/MSMQT and database adapters in polling scenarios can lead to this issue.

More information on this can be found at Kent Weares blog here.
* This post assumes a two node BizTalk Group.

Create Cluster Resource Group

The first step is to create an empty resource group to hold the cluster resource that is created when you cluster the receive host that you will use to pull messages from MSMQ.

  • Open Failover Cluster Management from the Primary BizTalk Node.
  • Select Services and Applications
  • Right Click and Select More Actions
  • Select Create Empty Service or Application
  • An entry is created in the left page named "New service or application"
  • Right click and rename this to "BTReceive"

Create BizTalk Host

  • Open the BizTalk Server 2009 Administration Console
  • Expand Platform Settings
  • Click and Expand Hosts
  • Right click on Hosts and select New-->Host

  • In the resulting dialog enter MSMQReceiveHost in the Name textbox
  • Make sure In-Process is checked
  • Set the appropriate Windows group
  • Click OK
Create BizTalk Host Instances

  • Open the BizTalk Server 2009 Administration Console
  • Expand Platform Settings
  • Click and Expand Host Instances
  • Right click on Host Instances and select New-->Host Instance

  • In the resulting dialog select MSMQReceiveHost from the Host name dropdown
  • Select the Primary BizTalk Node from the Server Dropdown.
  • Repeat the above steps and create a Host Instance on the Secondary Node.
Create Receive Handler

Create a Receive Handler and associate it with the MSMQReceive Host.

  • Under Platform Settings select the Adapters Node
  • Right click and select New Receive Handler

  • In the resulting dialog select MSMQReceiveHost in the Host Name dropdown
  • Click OK
 Note: There is a bug in the Administration Console that doesn't show the new Adapter Handler when you initially create it. You will need to close and reopen the Admin Console to see the new Handler.

Create Receive Port
  • Right click Receive Ports under the Application that needs to use the MSMQ Adapter
  • Create a new Receive Port
  • Name it MSMQReceive

Create Receive Location
  • Right click Receive Port Locations under the Application that needs to use the MSMQ Adapter
  • Create a new Receive Port Location
  • Name it ReceiveLocationMSMQ

* Make sure that the MSMQReceiveHost Host is selected in the Receive Handler dropdown.

  • Click the Configure button
  • Set the UserName and Password to a valid account that has access to the queue on your MSMQ Cluster
  • Set the Queue entry to the hostname and queue path using the FORMATNAME MSMQ Syntax
 Here is some more information on setting the correct FORMATNAME value.

Cluster BizTalk Host

  • Expand Platform Settings
  • Select the MSMQReceive Host in the left pane
  • Right click and select Cluster

  • From the resulting dialog select the BTReceive cluster resource group that you created earlier
  • Click OK

* Once this is complete you will notice the Clustered tab has a Yes value indicating that the host is clustered.

Also note that the Host Instances for the MSMQReceiveHost will have the following icon indicating that they are clustered.

Validate Clustering

You can validate that the clustered Host Instances behave as expected by using Failover Cluster Management Console to move the resource across nodes.

When the resource is moved to a different node this change can be validated by looking at the Host Instance on the node that you moved the resource to and checking that the host instance is started on that node and stopped on the previous owner node.

I hope this post has been helpful. If you have any questions please feel free to contact me.