Bagikan melalui


Message Queue Task

The Message Queue task allows you to use Message Queuing (also known as MSMQ) to send and receive messages between SQL Server Integration Services packages, or to send messages to an application queue that is processed by a custom application. These messages can take the form of simple text, files, or variables and their values.

By using the Message Queue task, you can coordinate operations throughout your enterprise. Messages can be queued and delivered later if the destination is unavailable or busy; for example, the task can queue messages for the offline laptop computer of sales representatives, who receive their messages when they connect to the network. You can use the Message Queue task for the following purposes:

  • Delaying task execution until other packages check in. For example, after nightly maintenance at each of your retail sites, a Message Queue task sends a message to your corporate computer. A package running on the corporate computer contains Message Queue tasks, each waiting for a message from a particular retail site. When a message from a site arrives, a task uploads data from that site. After all the sites have checked in, the package computes summary totals.

  • Sending data files to the computer that processes them. For example, the output from a restaurant cash register can be sent in a data file message to the corporate payroll system, where data about each waiter's tips is extracted.

  • Distributing files throughout your enterprise. For example, a package can use a Message Queue task to send a package file to another computer. A package running on the destination computer then uses a Message Queue task to retrieve and save the package locally.

When sending or receiving messages, the Message Queue task uses one of four message types: data file, string, string message to variable, or variable. The string message to variable message type can be used only when receiving messages.

You can also configure the task to use the SQL Server 2000 format for messages.

The task uses an MSMQ connection manager to connect to a message queue. For more information, see MSMQ Connection Manager. For more information about Message Queuing, see the MSDN Library.

The Message Queue task requires that the Integration Services service be installed. Some SQL Server components that you may select for installation on the Components to Install page or the Feature Selection page of the SQL Server Installation Wizard install a partial subset of Integration Services components. These components are useful for specific tasks, but the functionality of Integration Services will be limited. For example, the Business Intelligence Development Studio option installs the Integration Services components required to design a package, but the Integration Services service is not installed, and therefore the Message Queue task is not functional. To ensure a complete installation of Integration Services, you must select Integration Services on the Components to Install page. For more information about installing and running the Message Queue task, see Considerations for Installing Integration Services and 64 bit Considerations for Integration Services.

Note

The Message Queue task fails to comply with Federal Information Processing Standard (FIPS) 140-2 when the computer's operating system is configured in FIPS mode and the task uses encryption. If the Message Queue task does not use encryption, the task can run successfully.

Message Types

You can configure the message types that the Message Queue task provides in the following ways:

  • Data file message specifies that a file contains the message. When receiving messages, you can configure the task to save the file, overwrite an existing file, and specify the package from which the task can receive messages.

  • String message specifies the message as a string. When receiving messages, you can configure the task to compare the received string with a user-defined string and take action depending on the comparison. String comparison can be exact, case-sensitive or case-insensitive, or use a substring.

  • String message to variable specifies the source message as a string that is sent to a destination variable. You can configure the task to compare the received string with a user-defined string using an exact, case-insensitive, or substring comparison. This message type is available only when the task is receiving messages.

  • Variable specifies that the message contains one or more variables. You can configure the task to specify the names of the variables included in the message. When receiving messages, you can configure the task to specify both the package from which it can receive messages and the variable that is the destination of the message.

Sending Messages

When configuring the Message Queue task to send messages, you can use one of the encryption algorithms that are currently supported by the Message Queuing technology, RC2 and RC4, to encrypt the message. Both of these encryption algorithms are now considered cryptographically weak compared to newer algorithms, which Message Queuing technology do not yet support. Therefore, you should consider your cryptography needs carefully when sending messages using the Message Queue task.

Receiving Messages

When receiving messages, the Message Queue task can be configured in the following ways:

  • Bypassing the message, or removing the message from the queue.

  • Specifying a time-out.

  • Failing if a time-out occurs.

  • Overwriting an existing file, if the message is stored in a Data file.

  • Saving the message file to a different file name, if the message uses the Data file message type.

Integration Services includes a task that sends e-mail messages.

For more information about this task, click the following topic:

Custom Logging Messages Available on the Message Queue Task

The following table lists the custom log entries for the Message Queue task. For more information, see Implementing Logging in Packages and Custom Messages for Logging.

Log entry

Description

MSMQAfterOpen

Indicates that the task finished opening the message queue.

MSMQBeforeOpen

Indicates that the task began to open the message queue.

MSMQBeginReceive

Indicates that the task began to receive a message.

MSMQBeginSend

Indicates that the task began to send a message.

MSMQEndReceive

Indicates that the task finished receiving a message.

MSMQEndSend

Indicates that the task finished sending a message.

MSMQTaskInfo

Provides descriptive information about the task.

MSMQTaskTimeOut

Indicates that the task timed out.

Configuring the Message Queue Task

You can set properties through SSIS Designer or programmatically.

For more information about the properties that you can set in SSIS Designer, click one of the following topics:

For more information about how to set these properties in SSIS Designer, click the following topic:

Configuring the Message Queue Task Programmatically

For more information about programmatically setting these properties, click the following topic:

Integration Services icon (small) Stay Up to Date with Integration Services

For the latest downloads, articles, samples, and videos from Microsoft, as well as selected solutions from the community, visit the Integration Services page on MSDN or TechNet:

For automatic notification of these updates, subscribe to the RSS feeds available on the page.