Author |
Message
|
saikrishna8 |
Posted: Mon Apr 17, 2017 5:22 am Post subject: How to read RFH2/Named Properties of MQ message in API exits |
|
|
Newbie
Joined: 17 Apr 2017 Posts: 4
|
I have written and set up both API exits and channel exits using the sample codes provided by IBM and am able to receive most of the information such as Queue Manager name, Put Application Name and time etc.
However, I am unable to retrieve the RFH2 or Named Properties which are in Name-Value pair and are being set by the client application in each message.
The application is communicating from MQ client to the Queue Manager through CLNTCONN/SVRCONN channels.
Functions used in API exits for MQPUT operations:
---------------------------------------------------------
MQ_PUT_EXIT PutBefore;
void MQENTRY PutBefore ( PMQAXP pExitParms
, PMQAXC pExitContext
, PMQHCONN pHconn
, PMQHOBJ pHobj
, PPMQMD ppMsgDesc
, PPMQPMO ppPutMsgOpts
, PMQLONG pBufferLength
, PPMQVOID ppBuffer
, PMQLONG pCompCode
, PMQLONG pReason
)
MQ_PUT_EXIT PutAfter;
void MQENTRY PutAfter ( PMQAXP pExitParms
, PMQAXC pExitContext
, PMQHCONN pHconn
, PMQHOBJ pHobj
, PPMQMD ppMsgDesc
, PPMQPMO ppPutMsgOpts
, PMQLONG pBufferLength
, PPMQVOID ppBuffer
, PMQLONG pCompCode
, PMQLONG pReason
)
Function used in Channel exit :
----------------------------------
void MQENTRY ChannelExit ( PMQCXP pChannelExitParms,
PMQCD pChannelDefinition,
PMQLONG pDataLength,
PMQLONG pAgentBufferLength,
PMQVOID pAgentBuffer,
PMQLONG pExitBufferLength,
PMQPTR pExitBufferAddr)
Please provide any code snippet for retrieving the message properties in MQ API/Channel exits. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
bruce2359 |
Posted: Mon Apr 17, 2017 6:17 am Post subject: Re: How to read RFH2/Named Properties of MQ message in API e |
|
|
![](images/avatars/58715422151eef88d5f6e3.jpg) Poobah
Joined: 05 Jan 2008 Posts: 9405 Location: US: west coast, almost. Otherwise, enroute.
|
saikrishna8 wrote: |
However, I am unable to retrieve the RFH2 or Named Properties which are in Name-Value pair and are being set by the client application in each message. |
Is your code getting some kind of error ReasonCode? _________________ 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 |
|
![](templates/DAJ_Glass/images/spacer.gif) |
saikrishna8 |
Posted: Mon Apr 17, 2017 6:35 am Post subject: |
|
|
Newbie
Joined: 17 Apr 2017 Posts: 4
|
The code I have so far is working fine. But I am unable to identify the structure through which I can retrieve the additional message properties being set by the client application in Name-Value format. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
RogerLacroix |
Posted: Mon Apr 17, 2017 2:07 pm Post subject: Re: How to read RFH2/Named Properties of MQ message in API e |
|
|
![](images/avatars/136281076646ca0b3d89dee.gif) Jedi Knight
Joined: 15 May 2001 Posts: 3253 Location: London, ON Canada
|
saikrishna8 wrote: |
I have written and set up both API exits and channel exits |
Getting the information from channel send/receive exits would be a real pain. The data is chucked in 32KB sections (TSH data).
Easier method would be to get it from an API Exit on the Put After invocation of the exit. Also, there is a difference between an MQRFH2 message and a message with message properties. I can't give you any code because it took a fair bit of work to get it right in MQ Auditor.
<Vendor_Plug>Sometimes it is cheaper and faster to buy rather than build.</Vendor_Plug>
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
PaulClarke |
Posted: Mon Apr 17, 2017 3:10 pm Post subject: |
|
|
![](images/avatars/46729506851b1e76395b14.jpg) Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
I would say it is worse than that. Not only is parsing the data from send/receive exits a 'real pain' it is not supported. Firstly IBM does not publish the format. Secondly the format of the data can change at any moment (release) and Lastly the data could be encrypted or compressed anyway so will not make much sense.
I agree with Roger that an API EXit seems a far better way to go.
Cheers,
Paul. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
saikrishna8 |
Posted: Mon Apr 17, 2017 5:04 pm Post subject: |
|
|
Newbie
Joined: 17 Apr 2017 Posts: 4
|
Thanks for your responses. My first preference was also API exit and I have captured a lot of information from it. But since I could not get these properties, which was a major requirement, I was trying using channel exits as well.
Can you please guide on capturing these properties from API exits? |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
hughson |
Posted: Mon Apr 17, 2017 6:16 pm Post subject: |
|
|
![](images/avatars/810794940518bb946528b3.jpg) Padawan
Joined: 09 May 2013 Posts: 1916 Location: Bay of Plenty, New Zealand
|
Please read the following page in Knowledge Center:-
Writing API exits
Specifically the sub-section entitled "Using message handles in API exits". It also mentions a sample.
Cheers
Morag _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
saikrishna8 |
Posted: Mon Apr 17, 2017 6:35 pm Post subject: |
|
|
Newbie
Joined: 17 Apr 2017 Posts: 4
|
I had followed the guidelines and sample on the Writing API Exits IBM link for developing the application. But it gave invalid message handle error when I tried to access the message due to which I am stuck for quite sometime now. Any working code sample would be of great help. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
hughson |
Posted: Mon Apr 17, 2017 6:56 pm Post subject: |
|
|
![](images/avatars/810794940518bb946528b3.jpg) Padawan
Joined: 09 May 2013 Posts: 1916 Location: Bay of Plenty, New Zealand
|
Does the sample work for you? How does your code differ from the sample? Could you post your code? _________________ Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
|