Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to identify difft. message types coming through on the same queue?

Status
Not open for further replies.

prits

Programmer
Feb 14, 2001
1
CA
I am new to MQSeries and am working on the design for an application that involves two MQSeries servers conversing with each other. I am aware that this involves two channel pairs as a channel is unidirectional. The message sent over a channel could be one of various types. When the message is received in the local queue, how does one go about identifying what type of message it is? Is there something in the header that identifies the message type? How do I create a MQSeries message type once I know what data, types the message must be composed of? I am assuming that I can send messages of different types over the same queue. Is this correct? Ideally I am looking for sample code that shows two MQSeries servers talking to each other sending different message types preferably using the MQSeries for C++ API. Any feedback is appreciated.

Thanks
 
Okay, I am new to MQ, too. (Okay, that sounds funny)

Anyway, my understanding is that you can send a message to a queue that will trigger an application. Now, understanding this... If you are to send different messages, there are two ways to go about it. You can have the different messages going to different queues which will fire off different applications, or you have a single queue that that fires off an application developed by you that determines handles the various types of messages coming accross that queue.

This is just how I have come to understand it. Can anyone else verify this, or am I on the wrong track??

Thanks,
gordon
 
Triggering is just one way to launch an application with MQSeries. Regardless of how the applicaiton is started, the best way to differentiate between message types is to include the message type as part of the message data section. The MQMD (message descriptor) is really for MQSeries to use - yes, there is a MsgType field in the MQMD, but this is reserved for MQSeries to identify the 'type' of mesage (i.e. Datagram, report, request, reply).

As gordon points out, another method is to create seperate queues for each messahe type. However, this will create additional overhead in your application as it will need to open multiple queues to retrieve messages.

Cheers,

Scott Meridew
scott@mqsquared.com


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top