|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
AccountToken changed under MQPUT |
« View previous topic :: View next topic » |
Author |
Message
|
HenriqueS |
Posted: Fri Jan 25, 2008 12:07 pm Post subject: AccountToken changed under MQPUT |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
Folks, I have been trying to set my own accountingtoken before putting the message, but I had no success.
I´ve read that I shall use some parameters for opening the file as well for the put message options....but I still seeing my messages with the accoutingtoken set with MQ internal values...
Any ideas?
code snippet below:
Code: |
MQPMO P_options = {MQPMO_DEFAULT + MQPMO_SET_IDENTITY_CONTEXT};
LONG O_options = MQOO_OUTPUT + MQOO_SET_IDENTITY_CONTEXT;
MQOPEN(Hconn, &od, O_options, &Hobj, &CompCode, &Reason);
memcpy(md.AccountingToken, pMQXQH->MsgDesc.AccountingToken, MQ_ACCOUNTING_TOKEN_LENGTH);
MQPUT(Hconn, Hobj, &md, &P_options, *pDataLength, pMQXQH, &CompCode, &Reason);
|
_________________ HenriqueS
Certified Websphere MQ 6.0 System Administrator |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jan 25, 2008 1:45 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Is AccountingToken part of Identity Context?
Or do you need to use a different Context?
Also, do you need to adjust the MQPMO as well?
I'm guessing you've checked these... but I'm asking the question because I haven't checked in a while. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Fri Jan 25, 2008 2:48 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
|
Back to top |
|
 |
David.Partridge |
Posted: Mon Jan 28, 2008 3:12 am Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
Hmmm did you check the reason code after your mqopen and mqput?
If so what were they?
That will help a lot in determining what's wrong. Likely is that you don't have authority to set context, but ... _________________ Cheers,
David C. Partridge |
|
Back to top |
|
 |
HenriqueS |
Posted: Mon Jan 28, 2008 9:38 am Post subject: |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
Not sure if the code is 100% right, but both return '0'...
Code: |
MQPUT(Hconn, Hobj, &md, &P_options, *pDataLength, pMQXQH, &CompCode, &Reason);
char temp[10];
sprintf(temp, "%ld", Reason);
wlog(temp);
sprintf(temp, "%ld", CompCode);
wlog(temp);
void wlog(char *logmessage){
..write message in text file...
}
|
output:
MQExit.dll - 200801281526 - 0
MQExit.dll - 200801281526 - 0
David.Partridge wrote: |
Hmmm did you check the reason code after your mqopen and mqput?
If so what were they?
That will help a lot in determining what's wrong. Likely is that you don't have authority to set context, but ... |
_________________ HenriqueS
Certified Websphere MQ 6.0 System Administrator |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jan 28, 2008 10:00 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Wait?
This is inside an exit? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
HenriqueS |
Posted: Mon Jan 28, 2008 11:02 am Post subject: |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
Yes.
jefflowrey wrote: |
Wait?
This is inside an exit? |
_________________ HenriqueS
Certified Websphere MQ 6.0 System Administrator |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jan 28, 2008 11:15 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Are you sure you're allowed to update the MQMD inside whatever exit this is?
Are you trying to create a copy of a message, and log it somewhere?
Or edit a message that is "in flight"? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
HenriqueS |
Posted: Mon Jan 28, 2008 12:02 pm Post subject: |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
I am copying some fields of one message (the one flowing the channel) into a fresh message that is put into a local queue, it´s for control purposes.
A job goes into this local 'log queue' containing these semi-cloned (not all fields are cloned - only the correlid and the accounting token) and stores in a database as a proof of send.
I don´t see any reason why MQMD cannot be changed before the MQPUT since it is a fresh structure. I do understand that MQPUT may overwrite some fields, and thats why I was using those open and put options (they seem to override the MQPUT behaviour on the overwriting).
It may be something related to user privileges like anoter fellow said. There are constraints on who may open a file with these override options, but the returned Reason and CompCode do not help on this issue.
jefflowrey wrote: |
Are you sure you're allowed to update the MQMD inside whatever exit this is?
Are you trying to create a copy of a message, and log it somewhere?
Or edit a message that is "in flight"? |
_________________ HenriqueS
Certified Websphere MQ 6.0 System Administrator |
|
Back to top |
|
 |
RogerLacroix |
Posted: Mon Jan 28, 2008 12:30 pm Post subject: Re: AccountToken changed under MQPUT |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
HenriqueS wrote: |
Code: |
MQPMO P_options = {MQPMO_DEFAULT + MQPMO_SET_IDENTITY_CONTEXT};
LONG O_options = MQOO_OUTPUT + MQOO_SET_IDENTITY_CONTEXT;
MQOPEN(Hconn, &od, O_options, &Hobj, &CompCode, &Reason);
memcpy(md.AccountingToken, pMQXQH->MsgDesc.AccountingToken, MQ_ACCOUNTING_TOKEN_LENGTH);
MQPUT(Hconn, Hobj, &md, &P_options, *pDataLength, pMQXQH, &CompCode, &Reason);
|
|
Hi,
I'm surprised that the compiler didn't give you an error message because MQPMO_DEFAULT is an array initializer and MQPMO_SET_IDENTITY_CONTEXT is an integer.
Your code should look like:
Code: |
MQPMO pmo = {MQPMO_DEFAULT};
MQLONG O_options;
...
O_options = MQOO_OUTPUT + MQOO_FAIL_IF_QUIESCING + MQOO_SET_IDENTITY_CONTEXT;
MQOPEN(Hconn, &od, O_options, &Hobj, &CompCode, &Reason);
memcpy(md.AccountingToken, pMQXQH->MsgDesc.AccountingToken, MQ_ACCOUNTING_TOKEN_LENGTH);
pmo.Options = MQPMO_SET_IDENTITY_CONTEXT + MQPMO_FAIL_IF_QUIESCING;
MQPUT(Hconn, Hobj, &md, &pmo, *pDataLength, pMQXQH, &CompCode, &Reason); |
Also, when you use the SET_IDENTITY_CONTEXT option, it is the programmer's responsibility to set 3 fields of the MQMD:
- UserId
- AccountingToken
- ApplIdentityData
You will need to set the other 2 fields or they will appear as blank (null).
Hope that helps.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
HenriqueS |
Posted: Tue Jan 29, 2008 5:28 am Post subject: |
|
|
 Master
Joined: 22 Sep 2006 Posts: 235
|
'Grand Lacroix!' It worked, I did not notice the MQPMO vs. MQLONG types. _________________ HenriqueS
Certified Websphere MQ 6.0 System Administrator |
|
Back to top |
|
 |
David.Partridge |
Posted: Wed Jan 30, 2008 12:14 am Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
As a general rule you shouldn't use + when manipulating (for example) the PMO, you should use | (logical OR). + will work much of the time, until you "mess up". _________________ Cheers,
David C. Partridge |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|