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 » How to do get commit in multi thread environment.

Post new topic  Reply to topic
 How to do get commit in multi thread environment. « View previous topic :: View next topic » 
Author Message
James_O_K
PostPosted: Mon Jun 19, 2006 7:45 am    Post subject: How to do get commit in multi thread environment. Reply with quote

Apprentice

Joined: 09 Mar 2006
Posts: 39
Location: UK

Hello all,

Ive got an MQ listener app that polls a queue getting messages from it. It then spawns a thread to deal with the message and do some backend work before sending a reply message.

At the moment I do a destructive MQGET on every message, what I would like to do on certain messages is a get and then a commit. Looking at using SYNCPOINT it seems as though you just commit the get after popping the message, this is not suitable because of multi threading, so ideally I would like to be able to specify the message ID of the message I would like to pop off the queue.

Would I do this using an MQ browse and some kind of cursor? Does anyone have any sample code.

Thanks all

James.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jun 19, 2006 7:48 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You don't need to use browse. You can use regular syncpoint.

You just have to think a bit about how many messages will be in the syncpoint, and when you will be committing them.

The easiest way to do this is actually have each thread doing it's own get. Then you don't have to worry about synchronizing the commit across threads.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
8davitt
PostPosted: Tue Jun 20, 2006 5:11 am    Post subject: Reply with quote

Apprentice

Joined: 06 Feb 2003
Posts: 37
Location: Seated in front of monitor

You did not state you environment but 2 points to remember.

1. Refer to the Websphere Using Java manual and the several references regarding multithreaded applications and thread safety. See Chapters 7 & 10

http://www.elink.ibmlink.ibm.com/public/applications/publications/cgibin/pbi.cgi?CTY=US&FNC=SRX&PBL=SC34659101

2. J2EE has restrictions on creating threads.

/s
Back to top
View user's profile Send private message
James_O_K
PostPosted: Tue Jun 20, 2006 5:52 am    Post subject: Reply with quote

Apprentice

Joined: 09 Mar 2006
Posts: 39
Location: UK

jefflowrey wrote:
You don't need to use browse. You can use regular syncpoint.

You just have to think a bit about how many messages will be in the syncpoint, and when you will be committing them.

The easiest way to do this is actually have each thread doing it's own get. Then you don't have to worry about synchronizing the commit across threads.


Very good point, just unfortunate most of the message handler is already written!!
Back to top
View user's profile Send private message
James_O_K
PostPosted: Tue Jun 20, 2006 5:55 am    Post subject: Reply with quote

Apprentice

Joined: 09 Mar 2006
Posts: 39
Location: UK

8davitt wrote:
You did not state you environment but 2 points to remember.

1. Refer to the Websphere Using Java manual and the several references regarding multithreaded applications and thread safety. See Chapters 7 & 10

http://www.elink.ibmlink.ibm.com/public/applications/publications/cgibin/pbi.cgi?CTY=US&FNC=SRX&PBL=SC34659101

2. J2EE has restrictions on creating threads.

/s

Looks like a very useful doc. Thanks.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jun 20, 2006 6:01 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It's also in the Info Center, and (to my mind) more accessible there, and more up to date.

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzaw.doc/csqzaw14.htm
_________________
I am *not* the model of the modern major general.
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 Java / JMS » How to do get commit in multi thread environment.
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.