If you are working with queues in BizTalk Server, the most possible it is the MSMQ (in my experience).
MSMQ is an old man of the Microsoft technology stack. It was created when there were no good standards for messaging. Now MSMQ is wrapped partly in the .NET System.Messaging namespace. It is just a small facelift. MSMQ is still a proprietary technology without well-defined messaging protocol. It means, you cannot use the MSMQ messaging protocol without MSMQ itself.
Now we see vortex of new messaging standards and technologies. One on the top is the AMQP standard and one of the bold implementation of AMQP is the RabbitMQ.
It is one more protocol, one more messaging system which, for sure, can be integrated with BizTalk Server.
Here I will implement the standard queue messaging: sending and receiving messages from BizTalk down through the RabbitMQ queue. I am using the WCF-Custom LOB Adapter (provided from BizTalk side) and the WCF RabbitMQ Binding (provided from RabbitMQ side) to link two systems.
Assuming the BizTalk Server and the Visual Studio 2010 are also installed.
RabbitMQ service is installed. You can see it in the Services window.
Now it is time to install the client for .NET and WCF binding extension. Use this manual.
Here I really lost a lot of time. It is easy for the C# clients; the RabbitMQ.ServiceModel.Test gives all the information. But we have to use this binding from the WCF-Custom LOB adapter. To do so we have to add the assemblies to GAC, change machine.config, etc. See the WCF LOP Adapter documentation.
<extensions> <bindingExtensions> … <add name="RabbitMQBinding" type="RabbitMQ.ServiceModel.RabbitMQBindingSection, RabbitMQ.ServiceModel, Version=0.0.0.0, Culture=neutral, PublicKeyToken=1751e286f1ab778d"/> </bindingExtensions> </extensions> Note: When the binding extension assembly is placed in GAC, we cannot use the above section in the app.config file! This <add> element should be placed only into the machine.config file. Otherwise it cannot be seen in the binding extension list of the WCF LOB Adapter. Use >Gacutil.exe /l RabbitMQ.ServiceModel to get the real parameters for your assembly. I have several machine.config files in folders:
<extensions> <bindingExtensions> … <add name="RabbitMQBinding" type="RabbitMQ.ServiceModel.RabbitMQBindingSection, RabbitMQ.ServiceModel, Version=0.0.0.0, Culture=neutral, PublicKeyToken=1751e286f1ab778d"/> </bindingExtensions> </extensions>
Note:
Which one to use? My VM is 64bit. BizTalk Host of the port is 32bit. BizTalk is the 2010 version. In my case the right file was the C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config.
Finally the RabbitMQ binding installed and we can see it in the Binding Type list for WCF-Custom adapter.
I have created two pairs of port for testing.
File RP -> WCF-Custom (RabbitMQ) SP ->
[RabbitMQ Server]
-> WCF-Custom (RabbitMQ RP) -> File RP
I’ve changed only two parameters: “hostname” and “oneWay” and let others be default:
URL-s for the Send and Receive RabbitMQ Ports set up as “soap.amqp://192.168.11.128/Mytest” for both of them. Let’s test it. Small text file was dropped into In folder, consumed by Receive Port, went through the RabbitMQ queue, and appeared in Out folder. Success.
Note: Now the RabbitMQ binding is set up to process only well-formed Xml documents. “localhost” as “hostname” works fine.
The RabbitMQ binding is limited to the Text messaging encoding. If we need to change it or add more binding extensions, we have to use the customBinding type and use the rabbitMQBindingElement together with another element (including another encoding). How to do this?
1. Add the <add> node to the machine.config: <bindingElementExtensions> … <add name="rabbitMQBindingElement" type="RabbitMQ.ServiceModel.RabbitMQTransportElement, RabbitMQ.ServiceModel, Version=0.0.0.0, Culture=neutral, PublicKeyToken=1751e286f1ab778d"/> </bindingElementExtensions> 2. Change the Receive Location transport parameters. It was the RabbitMQBinding. Change it to the customBinding. The Transport Binding Element has to be changed to the rabbitMQBindingElement. I changed only one parameter: hostname as “localhost” 3. Test it as previously.
1. Add the <add> node to the machine.config:
<
bindingElementExtensions
>
…
add
name
=
"rabbitMQBindingElement"
type
"RabbitMQ.ServiceModel.RabbitMQTransportElement, RabbitMQ.ServiceModel, Version=0.0.0.0, Culture=neutral, PublicKeyToken=1751e286f1ab778d"
/>
</
2. Change the Receive Location transport parameters. It was the RabbitMQBinding. Change it to the customBinding. The Transport Binding Element has to be changed to the rabbitMQBindingElement. I changed only one parameter: hostname as “localhost”
3. Test it as previously.
Using RabbitMQ as one more transport for BizTalk and/or WCF applications is possible and straightforward. The learning curve is short. There are not too many issues with setting up the RabbitMQ Service and Client parts. Actually there isn’t any RabbitMQ side which is exposed to the BizTalk directly. RabbitMQ works only with WCF-Custom adapter and only this adapter communicates with RabbitMQ Service. Now the RabbitMQ implements limited client functionality for the WCF. RabbitMQ implements the version 9 of the AMQP protocol, not the last 1 version.
Next steps are to test this solution with different messaging patterns and try to figure out how to use RabbitMQ advantages (if there are some) over the MSMQ. Potentially the advantages are the simplest implementation of the Request/Response and Duplex patterns, better scalability, better performance, better manageability and support.
Maheshkumar S Tiwari edited Revision 13. Comment: Minor formating
Sandro Pereira edited Revision 10. Comment: Fixing TOC
Sandro Pereira edited Revision 9. Comment: fixing text , code and picture
Steef-Jan Wiggers edited Revision 7. Comment: Minor edits
Steef-Jan Wiggers edited Revision 6. Comment: Added Introduction and TOC
Steef-Jan Wiggers edited Revision 5. Comment: Added See Also
Great article. This might work for my current client.
Looks very promising. Good and clear article. Gotta try it out.
Awesome! AMQP with BizTalk!
Maheshkumar S Tiwari edited Revision 12. Comment: Minor formating