|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
MQ Server Exit to log put's/get's |
« View previous topic :: View next topic » |
Author |
Message
|
j1 |
Posted: Tue Oct 27, 2009 5:15 am Post subject: MQ Server Exit to log put's/get's |
|
|
 Centurion
Joined: 23 Jun 2003 Posts: 139
|
Hi,
We have an application that is complaining that their messages are getting misrouted in the MQ cluster. I need to be able to log the put MQMD and messaged data for evey put and get to a log file to correlate with their logs that indicate the 'misrouted' messages. I found the below two code snippets to log the MQMD and message hex data(say first x bytes). could some one help in proviging me with info as to how to put this in an Qmgr API exit. Is it possible to write exits in java? Is there any existing debugging exit that accomplishes this function? thanks
Code: |
#include <cmqc.h>
void printMD(MQMD *MDin)
{
int i;
printf("\n****Message descriptor****\n");
printf("\n StrucId : '%.4s'", MDin->StrucId);
printf(" Version : %d", MDin->Version);
printf("\n Report : %d", MDin->Report);
printf(" MsgType : %d", MDin->MsgType);
printf("\n Expiry : %d", MDin->Expiry);
printf(" Feedback : %d", MDin->Feedback);
printf("\n Encoding : %d", MDin->Encoding);
printf(" CodedCharSetId : %d", MDin->CodedCharSetId);
printf("\n Format : '%.*s'", MQ_FORMAT_LENGTH, MDin->Format);
printf("\n Priority : %d", MDin->Priority);
printf(" Persistence : %d", MDin->Persistence);
printf("\n MsgId : X'");
for (i = 0 ; i < MQ_MSG_ID_LENGTH ; i++)
printf("%02X",MDin->MsgId[i] );
printf("'");
printf("\n CorrelId : X'");
for (i = 0 ; i < MQ_CORREL_ID_LENGTH ; i++)
printf("%02X",MDin->CorrelId[i] );
printf("'");
printf("\n BackoutCount : %d", MDin->BackoutCount);
printf("\n ReplyToQ : '%.*s'", MQ_Q_NAME_LENGTH,
MDin->ReplyToQ);
printf("\n ReplyToQMgr : '%.*s'", MQ_Q_MGR_NAME_LENGTH,
MDin->ReplyToQMgr);
printf("\n ** Identity Context");
printf("\n UserIdentifier : '%.*s'", MQ_USER_ID_LENGTH,
MDin->UserIdentifier);
printf("\n AccountingToken : \n X'");
for (i = 0 ; i < MQ_ACCOUNTING_TOKEN_LENGTH ; i++)
printf("%02X",MDin->AccountingToken[i] );
printf("'");
printf("\n ApplIdentityData : '%.*s'", MQ_APPL_IDENTITY_DATA_LENGTH,
MDin->ApplIdentityData);
printf("\n ** Origin Context");
printf("\n PutApplType : '%d'", MDin->PutApplType);
printf("\n PutApplName : '%.*s'", MQ_PUT_APPL_NAME_LENGTH,
MDin->PutApplName);
printf("\n PutDate : '%.*s'", MQ_PUT_DATE_LENGTH, MDin->PutDate);
printf(" PutTime : '%.*s'", MQ_PUT_TIME_LENGTH, MDin->PutTime);
printf("\n ApplOriginData : '%.*s'\n", MQ_APPL_ORIGIN_DATA_LENGTH,
MDin->ApplOriginData);
printf("\n GroupId : X'");
for (i = 0 ; i < MQ_GROUP_ID_LENGTH ; i++)
printf("%02X",MDin->GroupId[i] );
printf("'");
printf("\n MsgSeqNumber : '%d'", MDin->MsgSeqNumber);
printf("\n Offset : '%d'", MDin->Offset);
printf("\n MsgFlags : '%d'", MDin->MsgFlags);
printf("\n OriginalLength : '%d'", MDin->OriginalLength); } /* end printMD */
|
Code: |
hex_dump_data( char *Buffer, int Datalength ) {
printf("\n ");
printf("\n**** Message ****\n ");
Buffer[DataLength] = '\0';
printf("\n length - %d bytes\n ", DataLength);
ch = 0;
overrun = 0;
do
{
chars_this_line = 0;
printf("\n%08X: ",ch);
for (;overrun>0; overrun--) /* for MBCS overruns */
{
printf(" "); /* dummy space for characters */
line_text[chars_this_line] = ' ';
/* included in previous line */
chars_this_line++;
if (overrun % 2)
printf(" ");
}
while ( (chars_this_line < CHARS_PER_LINE) &&
(ch < DataLength) )
{
char_len = mblen((char *)&Buffer[ch],mbcsmax);
if (char_len < 1) /* badly formed mbcs character */
char_len = 1; /* or NULL treated as sbcs */
if (char_len > 1 )
{ /* mbcs case, assumes mbcs are all printable */
for (;char_len >0;char_len--)
{
if ((chars_this_line % 2 == 0) &&
(chars_this_line < CHARS_PER_LINE))
printf(" ");
printf("%02X",Buffer[ch] );
line_text[chars_this_line] = Buffer[ch];
chars_this_line++;
ch++;
}
}
else
{ /* sbcs case */
if (chars_this_line % 2 == 0)
printf(" ");
printf("%02X",Buffer[ch] );
line_text[chars_this_line] =
isprint(Buffer[ch]) ? Buffer[ch] : '.';
chars_this_line++;
ch++;
}
}
/* has an mbcs character overrun the usual end? */
if (chars_this_line > CHARS_PER_LINE)
overrun = chars_this_line - CHARS_PER_LINE;
/* pad with blanks to format the last line correctly */
if (chars_this_line < CHARS_PER_LINE)
{
for ( ;chars_this_line < CHARS_PER_LINE;
chars_this_line++)
{
if (chars_this_line % 2 == 0) printf(" ");
printf(" ");
line_text[chars_this_line] = ' ';
}
}
/* leave extra space between columns if MBCS characters possible */
for (i=0;i < ((mbcsmax - overrun - 1) *2);i++)
{
printf(" "); /* prints space between hex representation and character */
}
line_text[chars_this_line] = '\0';
printf(" '%s'",line_text);
lines_printed += 1;
if (lines_printed >= 60)
{
lines_printed = 0;
printf("\n ");
}
}
while (ch < DataLength);
}
|
|
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Oct 27, 2009 5:54 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
...and by mis-routed, you mean what exactly? Where do the messages end up? Where should they have gone? _________________ 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 |
|
 |
WMBDEV1 |
Posted: Tue Oct 27, 2009 6:13 am Post subject: Re: MQ Server Exit to log put's/get's |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
j1 wrote: |
could some one help in proviging me with info as to how to put this in an Qmgr API exit
|
The fact that you have to ask this question is ringing alarm bells in my head as its no mean feat and should be avoided unless you really know what you are doing!
Quote: |
Is it possible to write exits in java?
|
This recent thread addresses this question:
http://www.mqseries.net/phpBB2/viewtopic.php?t=51276 |
|
Back to top |
|
 |
j1 |
Posted: Tue Oct 27, 2009 6:31 am Post subject: |
|
|
 Centurion
Joined: 23 Jun 2003 Posts: 139
|
well, application team says they put the messages destined for Queue A but are receiving it on Queue B. I need some way to debug it. MQ trace is not very helpful in correlating because their logs have only timestamps and not msgid's. I am at a loss as to how else to debug this. We need to show that you are putting msgid xx to queue A and are receiving msgid xx from Queue A. My theory is that what is happenign is that they are an Mq 5.3 client connecting to an MQ 6.0 server and their client MQ code was redone against MQ 6 client (though the prod MQ client is still MQ 5.3). There are multiuple dequeing apps that use the same cpp class using the imqQueue and iimqqueueManager names to get the handle. im thinking the handles are somehow getting mixed up and they are actually getting from Queue B when they 'think' they are getting from Queue A. comments are appreciated |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Oct 27, 2009 6:41 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
Are messages from all applications going to the wrong queues? Or is it just this one application? If it's just this one application, it will be far easier for the app team to modify the app in question for problem-determination.
As a diagnostic tool, the app should print the MQMD and MQOD contents before each put. _________________ 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 |
|
 |
WMBDEV1 |
Posted: Tue Oct 27, 2009 6:41 am Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
So.... In addition to bruces questions....
How many messages are being "misrouted"? 1 in 2? Every one?
Is this just in a prod enviornment or in all environments?
Do Queue A and Queue B have the same Queue names or are they different but on different QMs? Are these Queues shared in the cluster? Please provide more details about your setup.
You should be able to get to the bottom of this without the need to write the exit. |
|
Back to top |
|
 |
j1 |
Posted: Tue Oct 27, 2009 7:52 am Post subject: |
|
|
 Centurion
Joined: 23 Jun 2003 Posts: 139
|
the misrouting is happening randomly between different sets of queues on different occasions. these are all clustered queues with one instance each on 2 qmgrs. put/get is via MQ client connection |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Oct 27, 2009 8:08 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
the misrouting is happening randomly between different sets of queues on different occasions. these are all clustered queues with one instance each on 2 qmgrs. put/get is via MQ client connection |
Your answer is not specific enough. Please answer the questions asked.
Are all applications having this issue? Or just the one application? (This may tell us if it's a clustering software issue, or something else.)
Is this a new application?
If this is not a new application, what changes have been made to the application(s)?
If this is a new application, does/did the application behave the same way in TEST or QA? Or is it just production? Was this application tested at all? _________________ 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 |
|
 |
j1 |
Posted: Tue Oct 27, 2009 10:51 am Post subject: |
|
|
 Centurion
Joined: 23 Jun 2003 Posts: 139
|
yes sir, more than happy to answer questions not all applications are having the issue, it is a sporadic occurence. it is not even a consistent msrouting. the application is not new. the only thing that really changed is that we upgraded the MQ server from 5.3 to 6.0.2.1 and the client on the reading side remained at 5.3.11. the issue dod not recur in dev/qa where the application teams did test . the one thing that does seem consistent is that there were qmgr restarts over the weekend before the issue occured. the issue itself has been noted on different days, mondays,tuesdays, thursdays etc ... My theory is that the application code that reads the queues using a client channel table on MQ 5.3 (client) is somehow maintianing stale connections that persisting(sleeping say) over the restart and when the qmgr comes back up the connections are now pointing to a different queue and the dequeing application 'thinks' it is reading from the wrong queue. though im still at a loss how to prove the theory. i can also provide code snippets of the reading app (suitable modified for IPR issues). |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Oct 27, 2009 11:22 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
One huge paragraph is difficult to make sense of. It would help if you quoted a question, then posted your answer.
Quote: |
the only thing that really changed is that we upgraded the MQ server from 5.3 to 6.0.2.1 and the client on the reading side remained at 5.3.11. |
Are you saying that test, qa, and prod mq versions to all changed to 6.0.2.1? _________________ 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 |
|
 |
j1 |
Posted: Tue Oct 27, 2009 11:40 am Post subject: |
|
|
 Centurion
Joined: 23 Jun 2003 Posts: 139
|
yes. only in prod the client stayed at MQ 5.3 |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Oct 27, 2009 11:52 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9470 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
.. My theory is that the application code that reads the queues using a client channel table on MQ 5.3 (client) is somehow maintianing stale connections that persisting(sleeping say) over the restart |
Does the app do a get with wait? What is the waitinterval? _________________ 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 |
|
 |
gbaddeley |
Posted: Tue Oct 27, 2009 2:44 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
|
Back to top |
|
 |
mqjeff |
Posted: Tue Oct 27, 2009 6:15 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
|
Back to top |
|
 |
j1 |
Posted: Wed Oct 28, 2009 5:45 am Post subject: |
|
|
 Centurion
Joined: 23 Jun 2003 Posts: 139
|
MA0W does look promising. How does traceroute messages work? I dont have access to the code today, so will need to get back to you about the timing interval tomorrow. thanks |
|
Back to top |
|
 |
|
|
 |
Goto page 1, 2 Next |
Page 1 of 2 |
|
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
|
|
|
|