Windows Azure BizTalk SB adapter to Windows Azure Queue and back - Simple Example

Windows Azure BizTalk SB adapter to Windows Azure Queue and back - Simple Example








Configure Windows Azure Service Bus Queue


Queue-based technology is a very powerful way to exchange data between remote clients in an asynchronous manner.

Microsoft provides an asynchronous message queuing mechanism by providing: MSMQ and Azure Service Bus. MSMQ is an old technology present on the market  as a feature since NT4 and Windows 95. However Azure Service Bus was released in 2012.

BizTalk Server supports both MSMQ and SB mechanisms and it provides dedicated adapters. MSMQ comes with WCF Adapter and netMsmqBindings.
Azure Service Bus is supported by BizTalk Service Bus adapter.

  1. Download the Microsoft Azure Shell. ( This is needed because BizTalk Service Bus adapter uses Access Control Service or Access Control Signature for authentication
  2. Since the only option for authentication in Azure Portal is SAS (Shared Access Signature) a simple PowerShell script will be used to create an ACN (Access Control Namespace) for Azure Service Bus.

The syntax of the script:

New-AzureSBNamespace -Name <Your Namespace> -Location <Your Location> -
CreateACSNamespace $true -NamespaceType Messaging

  1. Web Platform Installer will give you the opportunity to install  the Azure PowerShell together with all the dependencies required






  1. Click I Accept and Install
  2. Restart your system
  3. Click start and type powershell, you should see Windows Azure PowerShell on the list
  4. Open Microsoft Azure PowerShell and type the following command in order to add your Windows Azure Account.

Add-AzureAccount


  1. Confirm the data collection agreement

  1. Sign in to your Azure account



  1. This is what you will get in response


  1. Log in:

  1. Create a new namespace with ACL authentication.

New-AzureSBNamespace -Name vmexpertisenamespace -Location “Central US” -
CreateACSNamespace $true -NamespaceType Messaging



  1. Regions available (2015)


  1. Let's create a queue to store all the messages.

  1. Choose Service Bus option. The namespace created should be listed on the screen.


  1. Choose the option to add a new queue

  1. Choose Service Bus, Queue and Custom Queue.


  1. Type the name of your queue, and choose the namespace created.


  1. Uncheck the option “Enable Partitioning”



  1. Configure BizTalk Send Port to store messages in the Azure Message Queue

  1. Open the Microsoft Biztalk Administration Console
  2. Create a new application by right clicking on the Applications
  3. Name the new application “SendMessageToAzureQueue” and click OK
  4. Right click Send Ports option, choose New and select Static-One-way-SendPort

  1. Give it a meaningful name. In the Choose SB-Messaging and XMLTransmit in the Send pipeline field.
  2. Type: SB-Messaging

  1. Click Configure… and on the General tab, provide the  URL of your queue that has the following format:

sb://TestNamespaceNorthernEurope.servicebus.windows.net/testqueuenortheurope

sb://<namespace>.servicebus.windows.net/<queue name>






  1. The URL can be extracted from the Azure portal
  2. Go to Service Bus > TestNamespaceNorthEurope > Queues > testqueuenortheurope and click on theconnection information link at the bottom of the page.
  1. This will give you the following:

Endpoint=sb://testnamespacenortheurope.servicebus.windows.net/;SharedAccessKeyName=MyNewPolicyName;SharedAccessKey=6WLd4fxvIvrm6p8QcVjifsa8o1TJuVFLrxNUdREhsuE=

Endpoint
sb://testnamespacenortheurope.servicebus.windows.net/   (please mind the final slash)
SharedAccessKeyName
MyNewPolicyName
SharedAccessKey
6WLd4fxvIvrm6p8QcVjifsa8o1TJuVFLrxNUdREhsuE=

  1. You can now configure your Send / Receive ports
  2. On the General tab use the endpoint from the above table and add the queue name

sb://testnamespacenortheurope.servicebus.windows.net/testqueuenortheurope

  1. Now it’s time to configure the authentication

SharedAccessKeyName: MyNewPolicyName
SharedAccessKey: 6WLd4fxvIvrm6p8QcVjifsa8o1TJuVFLrxNUdREhsuE=


  • Then, click OK twice, to finish

Configure Receive Port to get messages from the Message Queue


  • Right click Receive Ports, choose New and select One-way Receive Port...


  • Type a name according your standards


  • On Receive Locations, click New.
Type a name according your standards, and choose SB-Messaging on the Type field. Choose XMLReceive on Receive pipeline



  • Cic on Configure...button. The URL of the queue is the same of the send port created



256 K Limit on Queue
Turns out that there is a message limit of 256K. Testing it gives an interesting insight into which value is actually taken into account and it is the “Size” value, not the “Size on disk” value.
This message will go through
This message will fail in BizTalk
Surprisingly, when the message fail to transmit because of the 256K limit on queues, the error on BizTalk will not mention that. It will elude  a communication error which may be very misleading.  




















Comments

Popular posts from this blog

C# - Simple Class Library and how to use it in another project

AWS CLI - INSTALLATION AND CONFIGURATION

Upload a file to a Web server in ASP.NET by using Visual C# .NET