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 » Clone a message using C from a exit

Post new topic  Reply to topic
 Clone a message using C from a exit « View previous topic :: View next topic » 
Author Message
HenriqueS
PostPosted: Tue Sep 25, 2007 2:33 pm    Post subject: Clone a message using C from a exit Reply with quote

Master

Joined: 22 Sep 2006
Posts: 235

Hello, let´s say I want to clone a message, as it flows through a channel, into a specific queue, as given in the following exit funciton:

void MQENTRY MsgExit (PMQCXP pExitParms
,PMQCD pChannelDef
,PMQLONG pDataLength
,PMQLONG pAgentBufferLength
,PMQCHAR pAgentBuffer
,PMQLONG pExitBufferLength
,PMQCHAR *pExitBuffer
)
{
PMQXQH pMQXQH;
pMQXQH = (PMQXQH) pAgentBuffer;

/* clone message descriptor data */
PMQMD pMQMD;
pMQMD = &pMQXQH->MsgDesc;
memcpy( &md, pMQMD, sizeof( md ) );
...
MQPUT(Hconn, Hobj, &md, &pmo, *pDataLength, pAgentBuffer, &CompCode, &Reason);
...
}

The code above produces a message slightly different from the message that actually flows in the channel. Particularly the data below is NOT COPIED (or overwritten at a later step by MQ?):
a) UserIdentifier
b) PutApplName
c) PutApplType
d) ApplIdentityData
e) AccountingToken

Also, an interesting fact is that the message data itself is filled with the whole MQXQH (message data + several fields) structure (passing pAgentBuffer to MQPUT).

a) How can I make a real clone and put it into a queue? Is it possible?

b) How can I take only the message 'user'-data to the pAgentBuffer makes this happen, how can I cast it in a way only to recover the message and pass only it to the MQPUT paramater instead of the whole MQXQH structure?.

Hard topic, I know
_________________
HenriqueS
Certified Websphere MQ 6.0 System Administrator
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Sep 25, 2007 2:37 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

it would be a hard topic, if mirrorq didn't already solve it from an API Exit point of view.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Nigelg
PostPosted: Tue Sep 25, 2007 7:01 pm    Post subject: Reply with quote

Grand Master

Joined: 02 Aug 2004
Posts: 1046

a. You probably need one of the CONTEXT options on the put.

b. Read the data from an offset:

char *ptr = (char *)pMQXQH;
char *msgdata = ptr + sizeof(MQXQH);
_________________
MQSeries.net helps those who help themselves..
Back to top
View user's profile Send private message
HenriqueS
PostPosted: Mon Nov 05, 2007 11:06 am    Post subject: Reply with quote

Master

Joined: 22 Sep 2006
Posts: 235

Thanks Nigelg for the input. It gives the exact code to jump the message header and get to the message payload.

I had access to the production system here (using RFHUTIL to browse messages) and found out that actually the message is not really cloned. It is just encapsulated into a new datagram message, making the things easier.
_________________
HenriqueS
Certified Websphere MQ 6.0 System Administrator
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Clone a message using C from a exit
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.