Processing a Microsoft Queue

Problem

You want to write rows from a file into a Microsoft message queue. Then, you need to read the messages back from the queue and write them into a target table.

Solution

You can use the Microsoft Queue Writer transformation in SAS Data Integration Studio to write the data to the message queue. Then, you can use the Microsoft Queue Reader transformation to read the message from the queue and populate them into a target table. Perform the following tasks:

Tasks

Create the Microsoft Queue Job

Perform the following steps to create and populate the job:
  1. Create an empty job.
  2. Select and drag the Microsoft Queue Writer transformation from the Access folder in the Transformations tree into the empty job on the Diagram tab in the Job Editor window.
  3. Connect the source table to the input port of the Microsoft Queue Writer transformation.
  4. Connect the queue to the output port of the Microsoft Queue Writer transformation.
  5. Drag the Microsoft Queue Reader transformation onto the Diagram tab in the Job Editor window.
  6. Connect the queue to the Microsoft Queue Reader transformation.
  7. Because you want to have a permanent target table to contain the output for the transformation, right-click the temporary work table that is attached to the transformation and click Replace in the pop-up menu. Then, use the Table Selector window to select the target table for the job. The target table must be registered in SAS Data Integration Studio. (For more information about temporary work tables, see Working with Default Temporary Output Tables.)
    The job resembles the sample shown in the following display.
    Sample Microsoft Message Queue Process Flow
    Sample Microsoft Message Queue Process Flow
    The source table for the sample job is named CAKE. The target table is named CAKE2, and the queue is named cypress\venu\nontransactional.

Configure and Run the Microsoft Queue Job

Perform the following steps to configure the job:
  1. Open the Queue Options tab of the properties window for the Microsoft Queue Writer transformation.
  2. Specify the source for the queue. The sample job uses a file. You can also use text or a table as the source.
  3. Open the Queue Options tab of the properties window for the Microsoft Queue Reader transformation.
  4. Specify the target for the queue. The sample job uses a file. You can also use text or a table as the target.
  5. Run the job. If you are prompted to do so, enter a user ID and password for the default SAS Application Server that generates and runs SAS code for the job. The server executes the SAS code for the job. The following display shows that the job runs successfully.
    Sample Completed Microsoft Message Queue Job
    Sample Completed Microsoft Message Queue Job

Verify the Microsoft Queue Job

Perform the following steps to verify the results of the queue job:
  1. Examine the data in the source file.
  2. Access the View Data window for the target table. A sample target table is shown in the following example.
    Target Table Data for the Sample Job
    Target Table Data for the Sample Job
  3. Confirm that the source file and the target table contain identical data. This means that the data was transferred successfully through the Microsoft message queue.