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 Java / JMS » Multiple different MDBs retrieve the same message in MQ

Post new topic  Reply to topic
 Multiple different MDBs retrieve the same message in MQ « View previous topic :: View next topic » 
Author Message
miknaf
PostPosted: Tue Nov 08, 2005 11:03 pm    Post subject: Multiple different MDBs retrieve the same message in MQ Reply with quote

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
View user's profile Send private message
bower5932
PostPosted: Wed Nov 09, 2005 3:32 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
miknaf
PostPosted: Wed Nov 09, 2005 10:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
bower5932
PostPosted: Thu Nov 10, 2005 2:57 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
miknaf
PostPosted: Thu Nov 10, 2005 8:16 pm    Post subject: Reply with quote

Newbie

Joined: 08 Nov 2005
Posts: 5

hi,

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;

Yes, you were right. Nothing wrong to the MDB.

BTW, I would like share with you on this doc.
http://support.bea.com/application_content/product_portlets/support_patterns/wls/Troubleshooting_JMS_Message_Redelivery_Pattern.html

It's a good doc for troubleshooting the JMS.

I am very appreciating your advice/time/effort in helping me on this.

Many thanks.
Back to top
View user's profile Send private message
wschutz
PostPosted: Fri Nov 11, 2005 2:33 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
bower5932
PostPosted: Fri Nov 11, 2005 3:58 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
miknaf
PostPosted: Fri Nov 11, 2005 6:40 am    Post subject: Reply with quote

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
View user's profile Send private message
miknaf
PostPosted: Fri Nov 11, 2005 7:00 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Nov 11, 2005 10:18 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Fri Nov 11, 2005 10:16 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Multiple different MDBs retrieve the same message in MQ
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.