Send/Receive messages from MSMQ – SSIS
MSMQ – Microsoft Messaging Queue
MSMQ is a technology that helps application to communicate between heterogeneous network and even if the system is in offline temporally.
In simple way, applications communicate with MSMQ through messages. Those messages that are sent will be queued in the server if the target is busy or offline. Because, when the application is active again then messages will reach the application safely and securely.
Setup MSMQ in your machine if it is not enabled.
Message Queue Task (MQT)
It is the SSIS task helps the SSIS developer to communicate between MSMQ and SSIS Packages. SSIS can simply send the message to the queue or read it from the queue.
Purpose of this article
In this article, I will be explaining how to configure the Message Queue task to send and receive a string message.
You can also send a message stored in variable and receive message from MSMQ to a package variable, etc.
Read more about this task in MSDN. http://msdn.microsoft.com/en-us/library/ms141227.aspx
I have a SSIS package which has two message queue task and a script task. This package will send a message to the queue, read message from queue and display. I will explain how to configure MQT to send/receive a message in SSIS.
My package looks like this
My MSMQ configuration
Step 1: Create a package and add 2 Message Queue Task and a Script Task.
Step 2: Right click on the connection manager and create a Message Queue Connection Manager. Mention the Message Queue path in the path textbox. In this example, Message Queue is in my local machine. Dot represents local machine (.\private$\SSISQ).
Step 3: Connect all task as shown in the picture “My package looks like this”.
Step 4: Edit the send MQT, set the MSMQ connection and the Message property as shown in the below picture.
Step 5: Go to Send tab, set the message type and StringMessage property as shown in the below picture. Click OK.
Step 5: Edit the Receive MQT, Set the MSMQ Connection and Message property as shown in the below picture.
Step 6: Go to Receive tab, set the MessageType and Variable property as shown in the below picture.
Note: Create a new variable while setting variable property as given in the above picture.
Step 7: Now edit the scrip task, Assign variable “User::Variable” to the ReadOnlyVariables property. Click Edit Script button and add the below the script to display message. Close the script editor.
Step 8: Click Ok. Execute package now
Thanks for reading. Please Rate this article. If you need any help contact me immediately.