Sunday, March 7, 2010

IBM DataStage MQ Stages

MQ Stages

- MQ Connector stage
- MQ Stage

Read messages from and write messages to a WebSphere MQ enterprise messaging system
A queue manager manages one or more message queues
- The MQ stage or connector establishes a connection to a queue manager in order to read messages from or write messages to a queue.
Connecting to the queue manager
Server mode: The queue manager resides on the same machine as the MQ Connector stage
Client mode: The queue manager resides on a remote machine Specify channel name, transfor type ( TCP ), and remote connection name or IP address.
- Not supported by the MQ stage
- Supported by the MQ Connector stage
Queues
- Store messages
- Must be opened before messages can be written or read.

There are two stages that can be used to read and write MQ messages: MQ Connector stage, which has the same GUI as the ODBC Connector stage, and the MQ stage. The MQ Connector stage is the latest technology.

The MQ Connector stage is not available in the first release of DataStage v8.

MQ Messages

Message types
- Request: Reply is to be sent to the Reply-to-Queue
- Reply: Sent in response to a request message
- Report: No response message is required

Logical messages
- Composed of one or more physical messages on the queue
# Each physical message is called a segment
- Each segment has an offset
- The last segment contains a flag

Message groups
- Composed of one or more logical messages
- Each logical message has a sequence number
- The last message contains a flag

All record types are supported by the MQ stages. In this introductory course we will consider only the simplest type, datagram.
The user can specify the assembly of segments into a logical message.
The user can specify the assembly of messages into a message group.

Message Structure

# Two or three parts
- Header: Information about the content and structure of the data
- Optional format header: Information about the message format
- Payload: Message data

# Message schema
- Defines the type and structure of the data.

Client mode connection is only available in the MQ Connector.

This shows the WebSphere MQ Explore application. A message queue named QUEUE1 is displayed with some messages it contains.

Here the MQ Connector and MQ stages used to read messages from a queue. The stage has a single output link. Messages read are sent to Peek stages.


By default, the message limit is 0, meaning no limit, In that case the job will have no termination condition.


There can be multiple payload columns. This allows the read data to be parsed for later processing.


MQ Connector Stage

The queue manager can be selected from a list of discovered queue managers.

The queue can be selected from a list of discovered queues.

Here, we are filtering messages by payload size. In this messages with between 1 and 5 bytes of data and messages with 8 bytes of data will be read. Other messages will be left in the queue.

Fieleds defined without specified data elements are treated as payload fields.Multiple payload fields can created. The first payload field will extract the first n characters of the payload, where n is the length of the field. The second will extract the next characters in the payload. And so on.

Here the MQ Connector is used to write messages to the queue. So it has a single input link. Messages are read from a Row Generator stage.

3 comments:

Unknown said...

Hi Surendra, this is really good thankyou very much. we are trying to use MQ now. I will be really helpful if you can provide me with a more detailed step to step way of reading and writing to the MQ that would be really great. The IBM documentaion just gave about the MQ stage and no guide for the MQ Connector. Hope you can provide us.
Thanks. you can reply me at ashrajmi@gmail.com
Thanks.

terala said...

Hi Surendra,
It is very good document, i am also in process of using MQ in our environment. Can you please provide more details about setting up the environment before start using MQstages in Information Server?
You can reply me at terala_s@yahoo.com

Unknown said...

Hi Surendra,

I have a scenario where in Queue is having messages and this queue is connected to Real time, i placed a limit on Message Quantity as 50000 and due to MQ Infrastructure we have been asked to commit the transactions at each 1000 and then i am now using record count as 1000 under transaction with Message read mode as Delete(under transaction). So now when the job fails after 5000 records, due to commit intervals we are losing the data in target, is there any configuration i have to configure on MQ Connector not to delete the records until my job or connection closes.