Author |
Message
|
maha20 |
Posted: Wed Jun 29, 2005 9:40 am Post subject: Parsing different message formats |
|
|
 Voyager
Joined: 23 Sep 2003 Posts: 79
|
Hello -
How could I parse different message formats coming thru the same input node?. For instance if an application send different message format messages to the same Q how could I process them in my message flow?. Thanks, _________________ IBM Certified System Administrator -WMQ V5.3
SCJP 1.4 |
|
Back to top |
|
 |
martinrydman |
Posted: Wed Jun 29, 2005 11:02 am Post subject: |
|
|
 Centurion
Joined: 30 Jan 2004 Posts: 139 Location: Gothenburg, Sweden
|
You would need some way to distinguish them from each other. I'd set it up in 2 parts:
1. A router flow that routes each message type to a separate queue based on some criteria either in a header (like MQRFH2.usr.<some field>) or some predefined part of the pay-load.
2. A separate flow for each message type connected to one of the above queues
It is usually not a good idea to mix different message types on the same queue *except* when you plan to route them as outlined above.
If you receive mixed message types on the same queue without having a simple way of distinguish between them, then your basic architecture is flawed and you need to go back to the drawingboard.
/Martin |
|
Back to top |
|
 |
JT |
Posted: Wed Jun 29, 2005 11:27 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
You could also do this in a single mesage flow by setting the Message Domain on the MQInput node to BLOB. Then in a Compute node, distinguish the message type (as suggested by martinrydman), and then use the CREATE statement with the DOMAIN and PARSE clauses. |
|
Back to top |
|
 |
martinrydman |
Posted: Wed Jun 29, 2005 11:39 am Post subject: |
|
|
 Centurion
Joined: 30 Jan 2004 Posts: 139 Location: Gothenburg, Sweden
|
The main reason I'd recommend splitting it up is that it gives a clear and maintainable structure. You need to have a really good reason to bunch different message types together in a single flow for other processing than routing. Technically, it's fully possible though
/Martin |
|
Back to top |
|
 |
maha20 |
Posted: Wed Jun 29, 2005 12:49 pm Post subject: |
|
|
 Voyager
Joined: 23 Sep 2003 Posts: 79
|
Thanks Martin and JT. Martin as you recommend we will desgin the application to send different message formats to different queues.
Maha _________________ IBM Certified System Administrator -WMQ V5.3
SCJP 1.4 |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jun 30, 2005 3:58 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
A good solution, if you can do it, is to make the sender put an RFH2 header onto each message. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jun 30, 2005 4:17 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
kimbert wrote: |
A good solution, if you can do it, is to make the sender put an RFH2 header onto each message. |
And then make sure your code knows to look at the incoming message to know what it is.
Or do everything in XML, and have a different root tag for each message in a message family. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jun 30, 2005 4:52 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
If RFH2 headers are used, there should be no need for ESQL to re-parse the message. The correct parser will automatically be invoked. ESQL can then operate on the logical message tree without knowing or caring about its physical format. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jun 30, 2005 4:53 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
kimbert wrote: |
If RFH2 headers are used, there should be no need for ESQL to re-parse the message. The correct parser will automatically be invoked. ESQL can then operate on the logical message tree without knowing or caring about its physical format. |
I agree.
But your code still needs to know that it should process the message as Message A instead of as Message B.
 _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
martinrydman |
Posted: Thu Jun 30, 2005 5:09 am Post subject: |
|
|
 Centurion
Joined: 30 Jan 2004 Posts: 139 Location: Gothenburg, Sweden
|
This would mean that the sending app must set the correct details regarding the MRM settings (if it's not XML), which is not ncessarily the best way to go about it. We always let a sending app set some kind of tag in the usr area of MQRFH2, and then rout on this tag. Its a good thing to keep broker details within the broker.
/Martin |
|
Back to top |
|
 |
|