Salesforce

How Do I Receive an MSMQ Message? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Receive an MSMQ Message? (Magic xpa 3.x)

To receive an MSMQ message, you need to call three MSMQ programs from the component.

  • Open Queue: Opens the Send queue, and returns the queue handle that will be used for sending messages.

  • Read Message: Receive as many messages as needed, on the same queue handle.

  • Close Queue: closes the queue handle.

Detailed information about these three programs is found in Magic xpa Help. Here we will show a simple example.

1. Open the Message Queue

To open the Message queue, call the program MSMQ Open Queue, using ‘R’ for the fourth parameter. “R”, for “Read”, signifies that you will be reading the message from the queue, and the message will then be removed from the queue. If you use a “V”, for “View”, then your program will read the messages, but they will be left on the queue.

The rest of the parameters are described in the Open Queue section.

When the queue is successfully opened, it will return a numeric Queue handle. This handle is used as the first parameter in the Receive and Close programs

2. Read messages

Once the queue is open, you can receive messages using the MSMQ Read messages program. Every time the program is called, one message will be read from the message queue, and copied into the BLOB variable which is the 9th parameter.

For simple text messages that don’t use transactions, as in our example, you can leave most of the parameters blank.

The Timeout parameter indicates the amount of time to wait for a message in the queue. If you want the task to wait forever until a message shows up, use -1 for the Timeout parameter, and the task will halt until a message arrives. This is how to implement a “listener” task.

3. Close queue

After you are finished reading messages, you need to close the queue. Again, use the Queue handle you obtained in the Open Queue step.

Reference
Attachment 
Attachment