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 » General Discussion » Using Multiple Threads to perform the SYNC PT. operations

Post new topic  Reply to topic
 Using Multiple Threads to perform the SYNC PT. operations « View previous topic :: View next topic » 
Author Message
sonpat
PostPosted: Mon Jan 08, 2007 5:59 am    Post subject: Using Multiple Threads to perform the SYNC PT. operations Reply with quote

Newbie

Joined: 07 Jan 2007
Posts: 2

Hi all,

I have the following issue.

We have a scenario where multiple threads can execute the PUT and GET methods in the same MQQueue.

The PUT and GET are being done using SYNC POINT transactions.

When we run PUT method using around 5 threads parallelly, we find that the number of messages in the common queue not equal to the number of threads.

The code is something like this:

// set the PMO to SYNC POINT
pmo = MQC.MQPMO_SET_ALL_CONTEXT | MQC.MQPMO_SYNCPOINT;
queue.put(message, pmo);
queue.close();
queueManager.commit();
// Logger.info("Message PUT successfully");

We are using log4j to log the flow.

We find that the log file shows the log message 5 times(equal to no. of threads). But in the queue we find less than 5 messages. Also the code is placed in try-catch block and we do not get any exceptions also.


When we retried after removing the SYNC POINT option, it works.

But we have to implement SYNC POINT transaction logic.

Please help me in this regard.

Kindly give your valuable comments on this issue.


Regards,

Patrick
Back to top
View user's profile Send private message Yahoo Messenger
jefflowrey
PostPosted: Mon Jan 08, 2007 6:01 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The connection handle is the scope of the unit of work.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
sonpat
PostPosted: Mon Jan 08, 2007 6:08 am    Post subject: Reply with quote

Newbie

Joined: 07 Jan 2007
Posts: 2

jefflowrey wrote:
The connection handle is the scope of the unit of work.


So do you mean to say that the queuManager object when calls COMMIT,
all the threads are committed no matter what is the status of the PUT method, and thus some of the messages are not being committed.

Waiting for your response.

regards,

Patrick.
Back to top
View user's profile Send private message Yahoo Messenger
bruce2359
PostPosted: Mon Jan 08, 2007 1:15 pm    Post subject: Reply with quote

Guest




From the MQ Application Programming Reference: MQCMIT

5. A unit of work has the same scope as a connection handle; all MQ calls that affect a particular unit of work must be performed using the same connection handle. Calls issued using a different connection handle (for example, calls issued by another application) affect a different unit of work. See the Hconn parameter described in MQCONN for information about the scope of connection handles.
Back to top
jefflowrey
PostPosted: Mon Jan 08, 2007 1:21 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

What this means is that you need to use a different QueueManager object in each thread.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
liscerq
PostPosted: Tue Feb 06, 2007 4:42 am    Post subject: Reply with quote

Newbie

Joined: 06 Feb 2007
Posts: 2

Hello,

In the 1st post of this message I saw that "sonpat" could do exactly what I want to do...

I am trying to set a a scenario where multiple threads can execute the PUT/ GET methods in the a Write/Read MQQueue. The problem is that the second time a thread tries to:
- write to the same queue, it will fail with "reason code=2018" (when i use MQ_IN_EXCLUSIVE_BLK);
- open the same queue, it will fail with "reason code=0" (when i use MQ_IN_EXCLUSIVE_NOBLK).

Each thread:
1) invokes the MQCONNX() method (with MQCNO_NONE)
2) invokes the MQOPEN() method with:
- MQ_IN_EXCLUSIVE_NOBLK (if waitInterval == 0 )
- MQ_IN_EXCLUSIVE_BLK (if waitInterval >0 )

What i saw is that the MQCONNX "gives back" to each thread a different hConn, but as the MQOPEN method is invoked by the threads, the hConn has the value of the last returned hConn (by MQCONNX).


I would appreciate your help :)
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Feb 06, 2007 4:45 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

What language?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
liscerq
PostPosted: Tue Feb 06, 2007 6:11 am    Post subject: Reply with quote

Newbie

Joined: 06 Feb 2007
Posts: 2

C++
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 » General Discussion » Using Multiple Threads to perform the SYNC PT. operations
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.