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 » What defines a "Unit of Work" with MQ/Java syncpoi

Post new topic  Reply to topic
 What defines a "Unit of Work" with MQ/Java syncpoi « View previous topic :: View next topic » 
Author Message
speediii
PostPosted: Tue Apr 11, 2006 2:22 am    Post subject: What defines a "Unit of Work" with MQ/Java syncpoi Reply with quote

Novice

Joined: 11 Apr 2006
Posts: 19

This is maybe a stupid question but I've done a lot of reading and failed to find an answer to my question (really not so obvious from the documentation)

I have written a simple Java broker where I define Source & Target MQ Adapters in a configuration file - I then have a Controller Thread reading the configuration and moving messages from one source to one-to-many Targets.

I need to syncpoint the one GET MQ message operation together with the many MQ PUT operations. Sadly I thought that an MQ "unit of work" was defined by all put/get operations performed within the same Thread (obviously with MQxMO_SYNCPOINT set on each get/put). But it appears that I have to use the same MQQueueManager java Object for all the Get & Put operations? Which is tricky because my Source/Target java classes have their own MQQueueManager Object and Open the queue for Get or Put operations....

This wasn't that obvious as coding I'd done before with the Candlenet Roma Java libraries (that sit over MQ) had syncpoint transactions that were Thread based. This caused it's own problems but I understood that this was the way MQ was working.

Can someone please confirm that an MQ "unit of work" is all operations performed on the SAME MQQueueManager object (with MQxMO_SYNCPOINT used in the get & put options)?

If so, I will now have to restructure my Java code to define a common MQQueueManager object used by both the Source and one-to-many target adapters in each control flow....to do the MQQueueManager.commit()

Many thanks

Lee
Back to top
View user's profile Send private message
mvic
PostPosted: Tue Apr 11, 2006 2:31 am    Post subject: Re: What defines a "Unit of Work" with MQ/Java syn Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

speediii wrote:
Can someone please confirm that an MQ "unit of work" is all operations performed on the SAME MQQueueManager object (with MQxMO_SYNCPOINT used in the get & put options)?

Correct. But you also said

Quote:
Sadly I thought that an MQ "unit of work" was defined by all put/get operations performed within the same Thread

So is it really a problem to have a separate MQQueueManager on each thread? If you want separate units of work running independently on each thread, then the best way to achieve this is probably to have an MQQueueManager per thread.
Back to top
View user's profile Send private message
speediii
PostPosted: Tue Apr 11, 2006 2:40 am    Post subject: Reply with quote

Novice

Joined: 11 Apr 2006
Posts: 19

Thanks for the response - I was really looking for confirmation that this was the way it was working.

I want all operations per Thread to be in one "unit of work". This means I can only have one MQQueueManager defined per thread used by all Source & Target Adapters - tricky, because I'd done my object design contrary to this.

I will define one MQQueueManager object per Thread now and it should work I guess. I had looked at some open source code (OpenAdapter + Proteus amoungst others and these don't seem to work this way, hence I've gone down this path.

the MQ documentation talks about "unit of work", but it wasn't obvious to me that:

"a 'unit of work' is all get/put operations with SYNCPOINT in the options performed on the same, single MQQueueManager object"

This is important when designing more complex broker like Java code.

Thanks
Back to top
View user's profile Send private message
mvic
PostPosted: Tue Apr 11, 2006 3:09 am    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

speediii wrote:
the MQ documentation talks about "unit of work", but it wasn't obvious...

I see what you mean. In actual fact the MQ Java classes call the MQI to do the real work with the queue manager. The scope of a UOW in the MQI is per-hConn. The object in the Java classes that encapsulates the hConn is the MQQueueManager.

(If you had been using JMS, the object that encapsulates the hConn is the Session. However the transactional scoping in JMS is very clearly bound to the Session, leaving no room for doubt).

Sorry you had a problem with this. The most relevant information I could find in a quick browse through the Using Java manual is http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/com.ibm.mq.csqzaw.doc/csqzaw1430.htm
Back to top
View user's profile Send private message
speediii
PostPosted: Tue Apr 11, 2006 11:30 pm    Post subject: Reply with quote

Novice

Joined: 11 Apr 2006
Posts: 19

Having read the link you posted it now makes perfect sense. The previous wrapper classes I was using to code MQ connectors (The old Candlenet Roma classes) sat over the C libraries, hence the connections were Thread based, not Thread safe (synchronised).
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 » What defines a "Unit of Work" with MQ/Java syncpoi
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.