Author |
Message
|
Neo_47 |
Posted: Thu Jun 02, 2011 4:11 am Post subject: Message Exit |
|
|
Newbie
Joined: 02 Jun 2011 Posts: 7
|
Hello,
I need little helps / pointers for the message exit where I am trying to get the Message ID of messages passing through the RCVR channel.
PMQXQH pMQXQH;
pMQXQH = (PMQXQH) pAgentBuffer;
memcpy(msgId,pMQXQH-> MsgDesc.MsgId,MQ_MSG_ID_LENGTH);
Settings in the channel as :
MSGEXIT(/var/mqm/exits/Hello(MSGEXIT))
 |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 02, 2011 4:20 am Post subject: Re: Message Exit |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Neo_47 wrote: |
I need little helps / pointers for the message exit where I am trying to get the Message ID of messages passing through the RCVR channel. |
a) Why are you trying to obtain this information with an exit? What's the requirement?
b) What do you obtain from the posted code sample?
c) Given the advanced nature of user exits, and the dangers they pose to your WMQ environment, if you can't work out what's wrong are you convinced you have sufficient skills to develop this? And resolve any future problems? Like when your production environment goes down in flames at 3am & we're all asleep? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Neo_47 |
Posted: Thu Jun 02, 2011 4:29 am Post subject: Re: Message Exit |
|
|
Newbie
Joined: 02 Jun 2011 Posts: 7
|
Quote: |
a) Why are you trying to obtain this information with an exit? What's the requirement? |
Vitor - The requirement is to gather the MessagID of flowing through the channel.
Quote: |
b) What do you obtain from the posted code sample? |
Currently my channel is in Retrying state. Its a testing environment.
Quote: |
c) Given the advanced nature of user exits, and the dangers they pose to your WMQ environment, if you can't work out what's wrong are you convinced you have sufficient skills to develop this? And resolve any future problems? Like when your production environment goes down in flames at 3am & we're all asleep? |
This is still being tested. Not into production environment yet. Need to get my feet wet in Exits and thus trying to learn. Any pointers. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jun 02, 2011 4:41 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
maybe you should look at supportPac MA0Z. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 02, 2011 4:47 am Post subject: Re: Message Exit |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Neo_47 wrote: |
Quote: |
a) Why are you trying to obtain this information with an exit? What's the requirement? |
Vitor - The requirement is to gather the MessagID of flowing through the channel. |
That's not a requirement. Why are you gathering the MessageId? What purpose does this information serve? There may be an easier & safer way of achiveing this.
Neo_47 wrote: |
Quote: |
b) What do you obtain from the posted code sample? |
Currently my channel is in Retrying state. Its a testing environment.
|
I'd guess that either the channel configuration is wrong or your exit is not properly handling the exit blocks. Does the channel run with your exit removed and does the channel log have anything relevent with the exit in place?
Neo_47 wrote: |
Quote: |
c) Given the advanced nature of user exits, and the dangers they pose to your WMQ environment, if you can't work out what's wrong are you convinced you have sufficient skills to develop this? And resolve any future problems? Like when your production environment goes down in flames at 3am & we're all asleep? |
This is still being tested. Not into production environment yet. Need to get my feet wet in Exits and thus trying to learn. Any pointers. |
But one day it will be in production, and making a channel go into retry is one of the more harmless things an exit can do. Also getting into exits is an interesting choice given how often you write them (unless you're Roger and you sell them!) - I've produced 2 in 14 years of using WMQ and one of them I consider unnecessary (but the client insisted, paid me extra and signed a waiver against loss or damage).
There's nearly always a way round using an exit, and when there isn't it's well worth considering provided solutions (like Roger's many offerings or BlockIP2) which have a track record. _________________ Honesty is the best policy.
Insanity is the best defence.
Last edited by Vitor on Thu Jun 02, 2011 4:50 am; edited 1 time in total |
|
Back to top |
|
 |
Neo_47 |
Posted: Thu Jun 02, 2011 4:48 am Post subject: |
|
|
Newbie
Joined: 02 Jun 2011 Posts: 7
|
mqjeff wrote: |
maybe you should look at supportPac MA0Z. |
Thanks mqjeff !!
Will it be possible for someone to help me with some hint in what am I doing wrong in memcpy statement above. The main idea is not to get the message ID...its rather to do it with the exits
From my understanding msgDesc has MQMD format....How can I convert pAgentBuffer in MQMD so that I can fetch the MsgID.
I tried this code as well :-
PMQXQH pMQXQH = (PMQXQH) pAgentBuffer;
PMQMD pMQMD = (PMQMD) pMQXQH->MsgDesc;
memcpy(msgId,pMQMD->MsgId,MQ_MSG_ID_LENGTH);
But still the channel goes in retrying state and The error in MQ Logs says :-
AMQ9604: Channel 'TO_QM2' terminated unexpectedly
Using MQ V7.0.1.2 on Linux |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 02, 2011 4:50 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
maybe you should look at supportPac MA0Z. |
And it's my bad I didn't include this in my list of "provided solutions"  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 02, 2011 4:53 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Neo_47 wrote: |
Will it be possible for someone to help me with some hint in what am I doing wrong in memcpy statement above. |
What has led you to the conclusion that's the source of the problem? Explain your reasoning here (which I'm not saying is wrong).
Neo_47 wrote: |
its rather to do it with the exits |
Do what with exits? Just experiment? Why not try something safer, like repairing a wall socket with the power still on?  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Neo_47 |
Posted: Thu Jun 02, 2011 4:55 am Post subject: Re: Message Exit |
|
|
Newbie
Joined: 02 Jun 2011 Posts: 7
|
Quote: |
That's not a requirement. Why are you gathering the MessageId? What purpose does this information serve? There may be an easier & safer way of achiveing this. |
Well the main requirement to log everything that passes through MCA and I intend to believe exits can do that. to be specific I need to log data in the XQH. Will think to do something else with it later.
Quote: |
I'd guess that either the channel configuration is wrong or your exit is not properly handling the exit blocks. Does the channel run with your exit removed and does the channel log have anything relevent with the exit in place?
|
If the exits are removed channels works absolutely fine.
Quote: |
But one day it will be in production, and making a channel go into retry is one of the more harmless things an exit can do. Also getting into exits is an interesting choice given how often you write them (unless you're Roger and you sell them!) - I've produced 2 in 14 years of using WMQ and one of them I consider unnecessary (but the client insisted, paid me extra and signed a waiver against loss or damage). |
Well Yes...I am not Roger . neither do I sell exits .  |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 02, 2011 5:16 am Post subject: Re: Message Exit |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Neo_47 wrote: |
Will think to do something else with it later. |
So you're logging for the sake of logging. When you've thought of what you want actually do, post again. There's a sporting change the queue manager can provide the information for you.
As to your problem, I'll stand by my previous analysis. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Neo_47 |
Posted: Thu Jun 02, 2011 5:51 am Post subject: Re: Message Exit |
|
|
Newbie
Joined: 02 Jun 2011 Posts: 7
|
Quote: |
When you've thought of what you want actually do, post again. There's a sporting change the queue manager can provide the information for you. |
Ok. Putting my question in a more specific manner. I have been trying to parse the transmission header (pAgentBuffer) and get to the MessageData (MsgDesc). Failed with lot of attempts.
Below is the Code :-
PMQXQH pMQXQH;
pMQXQH = (PMQXQH) pAgentBuffer;
MQMD mqmd = (MQMD*)&pMQXQH->MsgDesc;
memcpy(msgId,mqmd.MsgId,MQ_MSG_ID_LENGTH);
( A different attempt )
Can Someone advise on this. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jun 02, 2011 5:59 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=/com.ibm.mq.csqzak.doc/fr16050_.htm wrote: |
Usage: A message that is on a transmission queue has two message descriptors:
* One message descriptor is stored separately from the message data; this is called the separate message descriptor, and is generated by the queue manager when the message is placed on the transmission queue. Some of the fields in the separate message descriptor are copied from the message descriptor provided by the application on the MQPUT or MQPUT1 call (see below for details).
The separate message descriptor is the one that is returned to the application in the MsgDesc parameter of the MQGET call when the message is removed from the transmission queue.
* A second message descriptor is stored within the MQXQH structure as part of the message data; this is called the embedded message descriptor, and is a copy of the message descriptor that was provided by the application on the MQPUT or MQPUT1 call (with minor variations; see below for details).
The embedded message descriptor is always a version-1 MQMD. If the message put by the application has nondefault values for one or more of the version-2 fields in the MQMD, an MQMDE structure follows the MQXQH, and is in turn followed by the application message data (if any). The MQMDE is either:
o Generated by the queue manager (if the application uses a version-2 MQMD to put the message), or
o Already present at the start of the application message data (if the application uses a version-1 MQMD to put the message).
The embedded message descriptor is the one that is returned to the application in the MsgDesc parameter of the MQGET call when the message is removed from the final destination queue.
|
|
|
Back to top |
|
 |
markt |
Posted: Thu Jun 02, 2011 6:34 am Post subject: |
|
|
 Knight
Joined: 14 May 2002 Posts: 508
|
|
Back to top |
|
 |
skoobee |
Posted: Thu Jun 02, 2011 7:02 am Post subject: |
|
|
Acolyte
Joined: 26 Nov 2010 Posts: 52
|
[code]
MQMD mqmd = (MQMD*)&pMQXQH->MsgDesc;
memcpy(msgId,mqmd.MsgId,MQ_MSG_ID_LENGTH);
[/code]
Try
[code]
PMQMD pmqmd = &pMQXQH->MsgDesc;
memcpy(msgId,pmqmd->MsgId,MQ_MSG_ID_LENGTH);
[/code] |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Jun 02, 2011 7:03 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
More specifically, exactly what were the results of your attempts?
Compile-time errors?
Run-time errors? If so, copy/paste results here so we can see what failed. What ReasonCode(s)? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
|