Author |
Message
|
miknaf |
Posted: Tue Nov 08, 2005 11:03 pm Post subject: Multiple different MDBs retrieve the same message in MQ |
|
|
Newbie
Joined: 08 Nov 2005 Posts: 5
|
Hi Gurus,
Below is my application architecture:
MyApp -- MQPUT --> MQSeries (REQ Q) --onMessage--> WebLogic (MDB) --> QueueSender.send --> MQSeries (RES Q) --> MyApp
My problem is there are multiple different MDBs pick up the same message from the REQ Q. This lead to generate multiple response messages. MyApp is not able to handle multiple same response messages.
I am using "Queue" not "Topic".
Regards,
Hong |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Nov 09, 2005 3:32 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I'd guess that you are picking up the message inside of a unit of work and then rolling back the unit of work. Your send is probably outside the unit of work. Messages are normally only picked up once. |
|
Back to top |
|
 |
miknaf |
Posted: Wed Nov 09, 2005 10:00 pm Post subject: |
|
|
Newbie
Joined: 08 Nov 2005 Posts: 5
|
hi,
Could you please guide me how to troubleshoot on this?
Below are the messages received by the 2 different MDBs.
These fields are same for both messages.
JMSTimestamp, JMS_IBM_PutTime and JMSXDeliveryCount
=== 1st ===
JMS Message class: jms_text
JMSType: null
JMSDeliveryMode: 1
JMSExpiration: 0
JMSPriority: 0
JMSMessageID: ID:73616d5f6d616e6167656431000000000000000000000000
JMSTimestamp: 1131599779910
JMSCorrelationID:null
JMSDestination: null
JMSReplyTo: null
JMSRedelivered: false
JMS_IBM_PutDate:20051110
JMSXAppID:dumbT.4ge
JMS_IBM_Format:MQSTR
JMS_IBM_PutApplType:6
JMS_IBM_MsgType:8
JMSXUserID:sam4adm
JMS_IBM_PutTime:05161991
JMSXDeliveryCount:1
50070050725132M2;j_login;gkng;cfs002;
=== 2nd ===
JMS Message class: jms_text
JMSType: null
JMSDeliveryMode: 1
JMSExpiration: 0
JMSPriority: 0
JMSMessageID: ID:73616d5f6d616e6167656431000000000000000000000000
JMSTimestamp: 1131599779910
JMSCorrelationID:null
JMSDestination: null
JMSReplyTo: null
JMSRedelivered: false
JMS_IBM_PutDate:20051110
JMSXAppID:dumbT.4ge
JMS_IBM_Format:MQSTR
JMS_IBM_PutApplType:6
JMS_IBM_MsgType:8
JMSXUserID:sam4adm
JMS_IBM_PutTime:05161991
JMSXDeliveryCount:1
50070050725132M2;j_login;gkng;cfs002;
Is it something wrong to my MGPUT?
MQHOBJ *HreqQ; /* object handle (server) */
MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
MQPMO pmo = {MQPMO_DEFAULT}; /* put message options */
MQLONG buflen; /* buffer length */
MQLONG CompCode; /* completion code */
MQLONG replylen; /* reply length */
MQLONG Reason; /* reason code */
MQLONG wait_int; /* Wait Interval */
char wait_int_str[10]; /* Wait interval string to receive env var */
memset(temp, '\0',1200);
md.MsgType = MQMT_DATAGRAM;
md.Report = MQRO_NONE ;
memcpy(md.Format, MQFMT_STRING, MQ_FORMAT_LENGTH);
msgNumber++;
strcpy(temp, ltoa(gethostid()));
strcat (temp, ltoa(getpid()));
strcat(temp, "M");
strcat(temp, ltoa(msgNumber));
strcpy(correlId, temp);
memcpy(md.MsgId, (MQBYTE24 *) serverId, strlen(serverId))
strcat(temp, ";");
strcat(temp, request);
md.CodedCharSetId = 1208;
strncpy(buffer,temp,1033);
buflen = strlen(buffer) + 1;
buffer[buflen] = '\0';
strncpy(buffer,temp,1033);
HreqQ = Hobj_ptr;
MQPUT(*Hcon_ptr, /* connection handle */
*HreqQ, /* object handle */
&md, /* message descriptor */
&pmo, /* default options */
buflen, /* buffer length */
buffer, /* message buffer */
&CompCode, /* completion code */
&Reason); /* reason code */
Thanks. |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Nov 10, 2005 2:57 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I'd suggest that you stop your MDB and check your queue's depth after putting the message. You could use amqsbcg to actually look at the message(s) on the queue to see if you have one or two. |
|
Back to top |
|
 |
miknaf |
Posted: Thu Nov 10, 2005 8:16 pm Post subject: |
|
|
Newbie
Joined: 08 Nov 2005 Posts: 5
|
|
Back to top |
|
 |
wschutz |
Posted: Fri Nov 11, 2005 2:33 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Quote: |
I've resolved the problem by setting the following values in MQPUT.
md.MsgType = MQMT_DATAGRAM;
md.Persistence = MQPER_PERSISTENT;
md.Report = MQRO_NONE ;
md.Expiry = 50;
|
I find it interesting (err...amazing actually) that by changing these values (what were they originally?) you fixed the problem. I don't see how this could have an effect on the problem you described (unless the mssage just expires after 5 seconds and it looks like the problem has been fixed).  _________________ -wayne |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Nov 11, 2005 3:58 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I'd have to agree with wschutz. I'd suggest that you change your expiry to unlimited and see what is really getting to the queue when the MDB is stopped. It will probably save you grief down the road. |
|
Back to top |
|
 |
miknaf |
Posted: Fri Nov 11, 2005 6:40 am Post subject: |
|
|
Newbie
Joined: 08 Nov 2005 Posts: 5
|
I've tested the followings:
A:
md.MsgType = MQMT_DATAGRAM;
md.Persistence = MQPER_PERSISTENT;
md.Report = MQRO_NONE ;
// md.Expiry = 50; - (I didn't set any just take the default)
=> Didn't work. Multiple MDBs processed same request.
B:
md.MsgType = MQMT_DATAGRAM;
md.Persistence = MQPER_NOT_PERSISTENT;
md.Report = MQRO_NONE ;
// md.Expiry = 50; - (Just take the default)
==> Didn't work. Multiple MDBs processed same request. Some requests were missing.
C:
md.MsgType = MQMT_DATAGRAM;
md.Persistence = MQPER_NOT_PERSISTENT;
md.Report = MQRO_NONE ;
md.Expiry = 50;
==> Didn't work. Multiple MDBs processed same request. Some requests were missing.
D:
md.MsgType = MQMT_DATAGRAM;
md.Persistence = MQPER_PERSISTENT;
md.Report = MQRO_NONE ;
md.Expiry = 50;
==> It worked. I ran 40 concurrent users with zero think time. All trxs were passed. Request and response were clean.
P/S: My app is actually MGPUTing the request into remote queue. To me it seems like my app just does not works properly for remote queue with the MQPER_NOT_PERSISTENT mode.
High-level architecture:
(Sending request)
MyApp (machine A) --- MQPUT --> REQ Q (machine B) -- MDB's onMessage --> WebLogic 8.1sp2 (machine C)
(Receiving response)
WebLogic 8.1sp2 (machine C) --- MDB sends response --> RES Q (machine B) -- MQGET --> MyApp (machine A) |
|
Back to top |
|
 |
miknaf |
Posted: Fri Nov 11, 2005 7:00 am Post subject: |
|
|
Newbie
Joined: 08 Nov 2005 Posts: 5
|
I am tested and it's confirmed that MyApp MQPUT only 1 request. Multiple MDBs processed the same request and send back with multiple same response.
I also found that those requests having "Redelivered_Flag = False". This means MBDs were not rereiving the redelivered request message. To MDB, these requests are considered new requests.
Must be something happened within the MQ Server. And must be something I didn't set correctly causing the problem.
This was what I thought. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Nov 11, 2005 10:18 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It's probably not something that happened in the MQserver. It's probably that your code is doing BROWSE or is not committing it's GET, and therefore leaving the message on the queue for someone else to see. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Nov 11, 2005 10:16 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
This seems to be a request reply scenario.
I suspect that with the non persistent messages the reply time was just on the other side of the time out thus causing the send to be repeated.
Then the reply would arrive as well as the reply to the next message....
If the replies are being processed by an MDB instead of a receiver and correlationID is not properly checked you do get the same message multiple times.
This has however nothing to do with MQ but with the application design...
Enjoy  |
|
Back to top |
|
 |
|