ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Does mq support header extension mechanism

Post new topic  Reply to topic Goto page 1, 2  Next
 Does mq support header extension mechanism « View previous topic :: View next topic » 
Author Message
deepu4u
PostPosted: Wed Aug 01, 2007 10:58 pm    Post subject: Does mq support header extension mechanism Reply with quote

Apprentice

Joined: 20 Jun 2005
Posts: 37

Hi all,
I want to specify some user defined properties as part of header ( not as a part of payload) of mq message. Is there a way to specify the user defined properties as part of MQMD header?
thanks
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Vitor
PostPosted: Wed Aug 01, 2007 11:58 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

No, the MQMD is a fixed format, but if you add an RFH2 header to the message you can put anything you want (within reason) within the header's usr folder.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
deepu4u
PostPosted: Thu Aug 02, 2007 1:09 am    Post subject: Reply with quote

Apprentice

Joined: 20 Jun 2005
Posts: 37

Hi Vitor,
Thanks for the reply.
Then a question arise that how would the application which would be consuming this message would know that the payload contains the RFH2 header.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Vitor
PostPosted: Thu Aug 02, 2007 1:12 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

deepu4u wrote:
Then a question arise that how would the application which would be consuming this message would know that the payload contains the RFH2 header.


Because (as laid out in the Application Programming Reference) the MQMD would indicate this fact.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Aug 02, 2007 3:23 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

In addition to the MQRFH/MQRFH2 headers, MQ allows you to put any number of headers after the MQMD, in any order, where the header can be anything you want it to be.

So you can string multiple MQRFH2 headers after the MQMD, followed by an MQCIH header, followed by a custom header. If one had gone slightly insane, perhaps.

Using a single MQRFH2 header, as suggested by Vitor, has several advantages. It's predefined and "well-known". It works very nicely with JMS and XMS. It's flexible and can hold all your data.

Headers are constructed sort of like HTTP Headers. Each header is separated from the next portion of the message by a blank line. All headers other than the MQMD are included in the message body. The Format field of the current header tells you what the next part of the message will be.

So the MQMD could indicate that the format is MQFMT_MQRFH2. OR MQFMT_STRING. Or some string constant that identified your custom header.

And the Format field of the MQRFH2 could indicate that the next piece is MQFMT_STRING, or MQRFH2, or etc.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
deepu4u
PostPosted: Thu Aug 02, 2007 3:56 am    Post subject: Reply with quote

Apprentice

Joined: 20 Jun 2005
Posts: 37

Thank you all for your reply.
I'll use RFH2 header to supply custom application header.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
bruce2359
PostPosted: Thu Aug 02, 2007 6:13 am    Post subject: Reply with quote

Guest




There are a variety of unused fields in the Message Descriptor (MQMD) that are available to the programmer for passing along additional information that can't be included in the application data payload. MsgId and CorrelId are two examples, if they are not used by your applications.
Back to top
Vitor
PostPosted: Thu Aug 02, 2007 6:25 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

bruce2359 wrote:
MsgId and CorrelId are two examples, if they are not used by your applications.


Errrmmmmmmm.........................
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Aug 02, 2007 6:31 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

bruce2359 wrote:
There are a variety of unused fields in the Message Descriptor (MQMD) that are available to the programmer for passing along additional information that can't be included in the application data payload. MsgId and CorrelId are two examples, if they are not used by your applications.


And the minute one writes one application that uses any field in the MQMD for business purposes, one has to ensure that every application that might possibly touch the messages (now or in the future) is aware that the MQMD is being used for business purposes.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Thu Aug 02, 2007 6:41 am    Post subject: Reply with quote

Guest




Quote:
Is there a way to specify the user defined properties as part of MQMD header?


The simple answer to the original post is yes. The complicated answer is either no or it depends.
Back to top
jefflowrey
PostPosted: Thu Aug 02, 2007 6:53 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

bruce2359 wrote:
Quote:
Is there a way to specify the user defined properties as part of MQMD header?


The simple answer to the original post is yes. The complicated answer is either no or it depends.


The simple answer to the original post is NO.

The complicated answer is "You can do it, if you really know what you're doing".
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Aug 02, 2007 7:10 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

jefflowrey wrote:
The complicated answer is "You can do it, if you really know what you're doing".


And if you're storing business data in the id fields, you better know exactly what you're doing!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Aug 02, 2007 8:25 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Vitor wrote:
jefflowrey wrote:
The complicated answer is "You can do it, if you really know what you're doing".


And if you're storing business data in the id fields, you better know exactly what you're doing!

I'd say you don't know what you're doing any more because you're breaking a number of concepts and patterns that MQ was built upon like anonymous identifier, uniqueness of the identifier etc...

But then that's just me ranting...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Thu Aug 02, 2007 11:18 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

fjb_saper wrote:
Vitor wrote:
jefflowrey wrote:
The complicated answer is "You can do it, if you really know what you're doing".


And if you're storing business data in the id fields, you better know exactly what you're doing!

I'd say you don't know what you're doing any more because you're breaking a number of concepts and patterns that MQ was built upon like anonymous identifier, uniqueness of the identifier etc...

But then that's just me ranting...


Exactly - you do this, you better know what you're doing. The MQ equivalent of a parachute jump with a bedsheet instead of a parachute. You may make it to the ground alive but it's not likely and it's going to hurt...
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Fri Aug 03, 2007 9:40 am    Post subject: Reply with quote

Guest




Uh, oh. Hyperbola alert!

Yes, in all things we should know what we're doing. One of several possible solutions was what I was offering with 'spare' fields in the MD.

If you can't change the application data payload (for whatever reason: contractual, being my favorite), yet need to send it and some other data along with it from point A to point B, there are always alternatives. I'm not all that fond of the one I suggested; but it's been done, it works, and it's pretty straight-forward.

This scenario violates best practices; but there are corpses of best practices littering all our collective floors. After all these years, and all these miles, someone out there is still testing in production, for example.
Back to top
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ API Support » Does mq support header extension mechanism
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.