How To - Tasks and Transformations: Message Queue Task

Written by Varigence Blog on 7.12.2011

TAGS: MistBISSIS

Share

My previous post returned to the theme of workflow tasks by discussing the SSIS Execute Package task, along with what Mist brings to the table. It’s now time to finish off the workflow tasks with the Message Queue task.

Background:

Microsoft Message Queuing (MSMQ) is a message queue implementation that’s existed in Windows operating systems for over 15 years. Its intent is to allow applications running on separate servers to communicate in a failsafe manner. From Wikipedia: “MSMQ is responsible for reliably delivering messages between applications inside and outside the enterprise. MSMQ ensures reliable delivery by placing messages that fail to reach their intended destination in a queue and then resending them once the destination is reachable.”

In terms of packages, MSMQ can be useful when two independent packages need to communicate with one another. For instance, if the outcome of one package’s execution needs to be communicated to another package. Of course, it’s possible to write to a message queue from any windows application; synchronization is not limited to just between packages.

In this post’s example, I’m going to walk through using the MSMQ task in BIDS and Mist to receive messages from the message queue. The scenario I’m picturing is that you have some application that performs required processing before your package should run. Thus, your package must wait to receive a message that processing is finished before executing.

Installing MSMQ:

To work through this sample, the computer where you run it must have MSMQ installed. If you’re unsure if MSMQ is installed, you can check by right clicking on My Computer and selecting Manage.

alt text here…

This opens the Computer Management console. Expand the Services and Applications node and check if a Message Queuing item is present. If it’s present, then MSMQ is installed. Otherwise, you need to install it.

At the end of this article, I've included a link to instructions for installing message queuing on Windows 7 and Server 2008 R2. Additionally, you can search online for installation instructions for other Windows operating systems.

Getting Started:

Because this sample involves messaging, and messages require a sender and receiver, I’ve written a very simple C# application that sends a message to a message queue. I’ve built the sample using Visual Studio 2010 although it can be run in .NET 2.0 or later.

The message generator application uses a hard-coded string for a message queue name, following the pattern of serverNameprivate$queueName. serverName is set to “.” to indicate the local server. The queue name is arbitrarily set to MsmqSample.

The message being sent is a simple text message of “My Msmq Sample”. The message also needs its label to be set so the MSMQ task can determine if the message matches one of its message types. In this case, the message’s Label property is set to “String Message.” See this MSDN forum post for more details.

When running, the application first checks if the message queue exists. If it does, it will send a message. If the queue doesn’t exist, it’s created and then the message is sent.

To confirm the application works, right click on My Computer and select Manage in the context menu. This opens the Computer Management console. Notice that under Services and Applications, there’s a Message Queuing directory.

Now, run the message generator application to send a message. To confirm the message was sent, right click on Private Queues and select Refresh. A new queue named msmqsample should appear. Expand its node to reveal its child items and select the Queue messages item.

alt text here…

Notice that in the center list, there is a single message. If you right click on the message and select Properties, a Properties dialog appears with detailed information about the message. If you select the Body tab, you’ll see the message’s body, confirming the intended message was sent.

alt text here…

With that working, it’s now time to discuss receiving the message within a package.

Using BIDS:

To get started with the Message Queue task, first find it in the Toolbox tool window.

alt text here…

Next, drag and drop the task onto the package’s design surface.

alt text here…

The red X icon indicates the task has errors. The Error List displays the following:

alt text here…

From the error list, it’s clear that the task requires a connection, which makes sense since it needs to be notified when a message is added to the message queue.

Double clicking on the Message Queue task brings up its properties dialog.

alt text here…

If you click inside the MSMQConnection field, you’ll see a down arrow button. Click on it to open a dropdown that invites you to create a new connection.

alt text here…

Click on “New connection” to open the MSMQ Connection Manager Editor.

alt text here…

The Path property needs to match the message queue path used in our message generator application, since this package will receive messages sent by the application. Enter the path in the Path text field.

alt text here…

The Test button verifies that the path is valid. Once a path is correctly entered, press OK to dismiss the dialog.

Next, in the Message property’s field, click on its value to open a popup. Switch the message’s type to Receive message.

alt text here…

As a result, in the dialog’s left list box, you can now click on the Receive item, which replaced the Send item.

alt text here…

The Receive page has several properties:

RemoveFromMessageQueue indicates whether to remove the message from the queue once it’s received. I suggest setting this to true to avoid having to remove messages manually.

TimeoutAfter lets you set a timeout, in seconds, for how long the task will wait if no message is received. The related ErrorIfMessageTimeOut property indicates whether an error message is displayed if timeout is reached.

The MessageType property indicates the message format that’s expected. You can choose from:

Format Description Data file message The message is in a data file Variable message The message is stored in a package variable String message The message is a string in the queue String message to variable The message is a string that will be saved to a variable The Compare property is set to None by default. However, you can set Compare to: Exact match, Ignore case, or Containing. These compare types indicate that the string message must meet the compare criteria for the Message Queue task to process them. Otherwise, the message is ignored.

With task set-up complete, press OK to dismiss the Message Queue Task editor dialog box. Build and Run the package in BIDS and, while it’s running, run the Message Generator application. The application will send a message to the queue. Your task should respond by turning green, as it successfully processes the message.

Using Mist:

To start, you’ll need to create a package. If you’re unfamiliar with how to create and open a package, you can follow the first couple steps in the Mist User Guide’s Creating a Package topic.

Once you’ve opened the package, navigate to the Toolbox tool window and find the Message Queue task.

alt text here…

Note that in the past, you’d have to search the treeview for the task you’re looking for. However, in an upcoming release, the Toolbox tool window has a search box so it’s easy to find the task you want.

Select and drag the Message Queue task onto the Package’s design surface.

alt text here…

The task has a red X icon indicating that it has errors.

alt text here…

The errors explain that Mist requires you to provide a MsmqConnection in the Message Queue task. To accomplish that, return to the logical view tool window, right click on the Connections group, and add a MSMQ connection.

alt text here…

Double click on the connection to open the connections editor.

alt text here…

In the Path field, enter the message queue path.

alt text here…

Then, reopen the package and select the Message Queue task. Click on the Package Details tab to see the properties for the task.

alt text here…

Looking at the details tool window, you can see that Mist mirrors the properties available in BIDS. Additionally, there are separate areas for both Send Message and Receive Message.

To assign the connection to the Message Queue task, open the MSMQ Connection dropdown and select MsmqConnection1.

alt text here…

To indicate that a received message should be removed from the queue, simply check the Remove from Queue checkbox.

Finally, right click on the package in the Logical View and select Build & Open in BIDS. That command will build your package and then open it in BIDS. You can then run the Message Generator and see that the task succeeds.

Samples:

The BIDS and Mist examples demonstrated above, along with the Message Generator application, can be downloaded here.

Links:

Message Queue documentation for the Biml language

Message Queue task - MSDN

Install Message Queuing on Windows 7 and Windows Server 2008 R2

Craig

Comments

Written by Guest on 9/26/2019 9:17:34 AM

https://sredstvo-cleanup.info/kupit/klinap-sredstvo-kupit.html

Written by Guest on 9/27/2019 11:05:32 PM

Где присмотреть себе шикарные <a href=https://stairsprom.ru>ограждение для лестницы в загородный дом

Written by Guest on 10/8/2019 8:39:31 PM

Приветствую вас Идет молва Препараты для лечения

<a href=https://anticancer24.ru/shop/442/desc/spegra-doluteglavir-tenofovir-alafenamid-ehmtricitabin>долутегравир таблетки

Written by Guest on 10/9/2019 6:47:15 AM

Любые товары из Тайланда на сайте <a href=https://superbank.ru>Супербанк.

<a href=https://superbank.ru/categories/%D0%A3%D1%85%D0%B0%D0%B6%D0%B8%D0%B2%D0%B0%D1%8E%D1%89%D0%B0%D1%8F-%D0%BA%D0%BE%D1%81%D0%BC%D0%B5%D1%82%D0%B8%D0%BA%D0%B0/>Косметика <a href=https://superbank.ru/categories/%D0%9B%D0%B5%D0%BA%D0%B0%D1%80%D1%81%D1%82%D0%B2%D0%B0-%D0%B8-%D1%81%D0%BD%D0%B0%D0%B4%D0%BE%D0%B1%D1%8C%D1%8F/>Товары для здоровья <a href=https://superbank.ru/categories/%D0%9B%D0%B5%D0%BA%D0%B0%D1%80%D1%81%D1%82%D0%B2%D0%B0-%D0%B8-%D1%81%D0%BD%D0%B0%D0%B4%D0%BE%D0%B1%D1%8C%D1%8F/%D0%9F%D0%B8%D0%BB%D1%8E%D0%BB%D0%B8-%D0%BD%D0%B0-%D1%82%D1%80%D0%B0%D0%B2%D0%B0%D1%85-%D0%B8-%D1%80%D0%B0%D1%81%D1%82%D0%B5%D0%BD%D0%B8%D1%8F%D1%85%2C-%D0%91%D0%90%D0%94%D1%8B/>Тайские целебные травы и растения <a href=https://superbank.ru/categories/%D0%9B%D0%B5%D0%BA%D0%B0%D1%80%D1%81%D1%82%D0%B2%D0%B0-%D0%B8-%D1%81%D0%BD%D0%B0%D0%B4%D0%BE%D0%B1%D1%8C%D1%8F/%D0%A2%D0%B0%D0%B9%D1%81%D0%BA%D0%B8%D0%B5-%D0%BC%D0%B0%D0%B7%D0%B8-%D0%B8-%D0%B1%D0%B0%D0%BB%D1%8C%D0%B7%D0%B0%D0%BC%D1%8B/>Тайские мази, бальзамы <a href=https://superbank.ru/pages/%D0%9B%D0%B5%D0%BA%D0%B0%D1%80%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D1%8B%D0%B5-%D1%82%D1%80%D0%B0%D0%B2%D1%8B-%D0%B8-%D1%80%D0%B0%D1%81%D1%82%D0%B5%D0%BD%D0%B8%D1%8F-%D0%A2%D0%B0%D0%B9%D0%BB%D0%B0%D0%BD%D0%B4%D0%B0.html>Народная медицина Тайланда <a href=https://superbank.ru/categories/%D0%9B%D0%B5%D0%BA%D0%B0%D1%80%D1%81%D1%82%D0%B2%D0%B0-%D0%B8-%D1%81%D0%BD%D0%B0%D0%B4%D0%BE%D0%B1%D1%8C%D1%8F/%D0%9F%D0%B8%D0%BB%D1%8E%D0%BB%D0%B8-%D0%BD%D0%B0-%D1%82%D1%80%D0%B0%D0%B2%D0%B0%D1%85-%D0%B8-%D1%80%D0%B0%D1%81%D1%82%D0%B5%D0%BD%D0%B8%D1%8F%D1%85%2C-%D0%91%D0%90%D0%94%D1%8B/>БАД-ы, пищевые добавки <a href=https://superbank.ru/categories/%D0%9B%D0%B5%D0%BA%D0%B0%D1%80%D1%81%D1%82%D0%B2%D0%B0-%D0%B8-%D1%81%D0%BD%D0%B0%D0%B4%D0%BE%D0%B1%D1%8C%D1%8F/%D0%9F%D1%80%D0%B5%D0%BF%D0%B0%D1%80%D0%B0%D1%82%D1%8B-%D0%B4%D0%BB%D1%8F-%D0%BF%D0%BE%D0%B2%D1%8B%D1%88%D0%B5%D0%BD%D0%B8%D1%8F-%D0%BC%D1%83%D0%B6%D1%81%D0%BA%D0%BE%D0%B9-%D0%BF%D0%BE%D1%82%D0%B5%D0%BD%D1%86%D0%B8%D0%B8/>Препараты для усиления половой потенции <a href=https://superbank.ru/pages/%D0%9A%D0%BE%D0%BA%D0%BE%D1%81%D0%BE%D0%B2%D0%BE%D0%B5-%D0%BC%D0%B0%D1%81%D0%BB%D0%BE.html>Знаменитое кокосовое масло <a href=https://superbank.ru/categories/%D0%9B%D0%B5%D0%BA%D0%B0%D1%80%D1%81%D1%82%D0%B2%D0%B0-%D0%B8-%D1%81%D0%BD%D0%B0%D0%B4%D0%BE%D0%B1%D1%8C%D1%8F/%D0%A1%D0%BE%D0%BA-%D0%BD%D0%BE%D0%BD%D0%B8-%D0%B8%D0%B7-%D0%A2%D0%B0%D0%B9%D0%BB%D0%B0%D0%BD%D0%B4%D0%B0/>Целебный сок нони <a href=https://superbank.ru/categories/%D0%9F%D0%B8%D1%89%D0%B5%D0%B2%D1%8B%D0%B5-%D1%82%D0%BE%D0%B2%D0%B0%D1%80%D1%8B%2C-%D0%BA%D1%83%D0%BB%D0%B8%D0%BD%D0%B0%D1%80%D0%B8%D1%8F/%D0%9A%D0%BE%D1%84%D0%B5-%D0%B8%D0%B7-%D0%A2%D0%B0%D0%B9%D0%BB%D0%B0%D0%BD%D0%B4%D0%B0/>Чай, кофе из Тайланда <a href=https://superbank.ru/categories/%D0%A1%D1%80%D0%B5%D0%B4%D1%81%D1%82%D0%B2%D0%B0-%D0%B4%D0%BB%D1%8F-%D0%BF%D0%BE%D1%85%D1%83%D0%B4%D0%B5%D0%BD%D0%B8%D1%8F/>Средства для похудения <a href=https://superbank.ru/categories/%D0%9F%D0%BE%D0%B4%D1%83%D1%88%D0%BA%D0%B8-%D0%B8-%D0%BC%D0%B0%D1%82%D1%80%D0%B0%D1%86%D1%8B-%D0%B8%D0%B7-%D0%BB%D0%B0%D1%82%D0%B5%D0%BA%D1%81%D0%B0/>Подушки из латекса <a href=https://superbank.ru/categories/%D0%A3%D1%85%D0%B0%D0%B6%D0%B8%D0%B2%D0%B0%D1%8E%D1%89%D0%B0%D1%8F-%D0%BA%D0%BE%D1%81%D0%BC%D0%B5%D1%82%D0%B8%D0%BA%D0%B0/%D0%A3%D1%85%D0%BE%D0%B4-%D0%B7%D0%B0-%D0%B2%D0%BE%D0%BB%D0%BE%D1%81%D0%B0%D0%BC%D0%B8-%28%D1%88%D0%B0%D0%BC%D0%BF%D1%83%D0%BD%D1%8C%2C-%D0%BA%D0%BE%D0%BD%D0%B4%D0%B8%D1%86%D0%B8%D0%BE%D0%BD%D0%B5%D1%80%2C-%D0%BC%D0%B0%D1%81%D0%BA%D0%B0%29/>Маски для волос <a href=https://superbank.ru/categories/%D0%A3%D1%85%D0%B0%D0%B6%D0%B8%D0%B2%D0%B0%D1%8E%D1%89%D0%B0%D1%8F-%D0%BA%D0%BE%D1%81%D0%BC%D0%B5%D1%82%D0%B8%D0%BA%D0%B0/%D0%9C%D1%8B%D0%BB%D0%BE-%D0%B8%D0%B7-%D0%A2%D0%B0%D0%B9%D0%BB%D0%B0%D0%BD%D0%B4%D0%B0/>Мыло <a href=https://superbank.ru/categories/%D0%A3%D1%85%D0%BE%D0%B4-%D0%B7%D0%B0-%D0%BF%D0%BE%D0%BB%D0%BE%D1%81%D1%82%D1%8C%D1%8E-%D1%80%D1%82%D0%B0/%D0%A2%D0%B0%D0%B9%D1%81%D0%BA%D0%B0%D1%8F-%D0%B7%D1%83%D0%B1%D0%BD%D0%B0%D1%8F-%D0%BF%D0%B0%D1%81%D1%82%D0%B0/>Зубная паста <a href=https://superbank.ru/categories/%D0%A3%D1%85%D0%B0%D0%B6%D0%B8%D0%B2%D0%B0%D1%8E%D1%89%D0%B0%D1%8F-%D0%BA%D0%BE%D1%81%D0%BC%D0%B5%D1%82%D0%B8%D0%BA%D0%B0/%D0%94%D0%B5%D0%B7%D0%BE%D0%B4%D0%BE%D1%80%D0%B0%D0%BD%D1%82-%D0%B8%D0%B7-%D0%A2%D0%B0%D0%B9%D0%BB%D0%B0%D0%BD%D0%B4%D0%B0/>Дезодорант

Written by Guest on 10/9/2019 7:20:33 PM

If you’re upset about your weight and want to lose a little more, get this…

An overweight mother with pre-diabetes has just SHOCKED the medical community by losing an unheard of 22lbs pounds in just 13 days…

....Without starving herself, she lost a total of 37lbs in the first month! <a href=http://webbyt.co/weightloss>-> CLICK HERE to see her Transformation Pics!

...Even without exercising, she went on to burn off 84lbs (almost a pound a day) and eliminated any sign of diabetes or any other life-ending diseases.

And the amazing thing is…

All she did was this D.I.Y. “carb-pairing” trick that reconditions your 3 female weight-loss hormones to drastically accelerate fat-burning while still eating the foods you love.

Check it out for yourself…

<a href=http://webbyt.co/weightloss>“Carb-Pairing” Melts Away 37 Pounds in Just 20 Days (WOMEN ONLY)

Enjoy!

Written by Guest on 10/11/2019 6:06:22 PM

Hi! I could have sworn I’ve been to this blog before but after looking at a few of the posts I realized it’s new to me. Regardless, I’m definitely happy I came across it and I’ll be bookmarking it and checking back frequently!

Written by Guest on 10/12/2019 12:12:34 PM

Почему такая разница о домофонов без трубки (UKP-66) белая за полторы тысячи остальные существенно больше двух тысяч, там, что золото применяют в краске?

Written by Guest on 10/17/2019 8:54:14 PM

<a href=http://guelphchinese.com/bbs/home.php?mod=space&uid=36329>wwww

Any broken items or equipment in order to be replaced. There grocery stores that are better than others. For further information information, call (816) 380-4680. Making these items will provide much more income. <a href=http://forum.usabattle.net/members/manuelpoeli.30827/>wwww