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 API Support » Threading and Get with wait

Post new topic  Reply to topic
 Threading and Get with wait « View previous topic :: View next topic » 
Author Message
bartland
PostPosted: Wed May 26, 2004 3:47 pm    Post subject: Threading and Get with wait Reply with quote

Novice

Joined: 04 May 2004
Posts: 15

Using MQAX200

In amqtan02.pdf (pg 19), it says

Quote:
WebSphere MQ Automation Classes for ActiveX implement a free-threading model where objects can be used between threads.
While MQAX permits the use of MQQueue and MQQueueManager objects,
WebSphere MQ does not currently permit the sharing of handles between different threads. Attempts to use these on another thread result in an error and WebSphere MQ returns a return code of MQRC_HCONN_ERROR.
........


Objects? Handles? Based in this and other meagre tidbits scattered aroung some other manuals, my current interpretation is object means class and handle means object. That is the MQQueue class is thread-safe but each thread must have its own instance of the class (ie object ie handle).

Is this right or wrong?

On the matter of get & wait. It seems to be an utterly useless call since there is no way of waking it up before the timeout (is this true?) - say when the app/service wants to quit. It would be better implemented as a kind of alertable event. At the moment my theads will be polling queues (one per queue since ordering is important) for messages and using alertable events to sleep between polls - not the best way really.
_________________
bruce
Back to top
View user's profile Send private message
bduncan
PostPosted: Wed May 26, 2004 4:15 pm    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

Right.
An object (which represents a handle to a queue or queue manager) cannot be shared among threads.
And this is true of any MQ API, not just ActiveX.

On the second point, get with wait isn't useless (it just depends on your particular needs). In your case, it sounds like you need some way to interrupt, in which case there are other ways to get the MQGET call to finish early. For instance, get disabling the queue while your application is sitting in a get/wait call will force the call to return.
Simiarly, if you set the FAIL_IF_QUIESCING parameter, then shutting down the queue manager will force the MQGET call to complete early.
_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator
Back to top
View user's profile Send private message Visit poster's website AIM Address
PeterPotkay
PostPosted: Wed May 26, 2004 4:31 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

Or you can send a message to the queue that will satisfy the MQGET, and the format of this particular message will tell the app to end instead of issuing another MQGET with WAIT.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
bartland
PostPosted: Wed May 26, 2004 5:46 pm    Post subject: Reply with quote

Novice

Joined: 04 May 2004
Posts: 15

hmm! So if I want the APP (which is an NT Service) to control the connect/disconnect I'd send a message to the queue from another thread. A bit roundabout but pretty good.

thanks
_________________
bruce
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 26, 2004 6:22 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

bduncan wrote:
Right.
An object (which represents a handle to a queue or queue manager) cannot be shared among threads.
And this is true of any MQ API, not just ActiveX.

Actually, this is only mostly true in 5.3. (sorry, I"ve already checked the pockets...)

5.3 introduced the notion of thread-shareable connection handles- and MTS in particular automatically creates connection handles that are shareable.

So, please double-check your documentation and look here for complaints about error code 2018. 2018 is related to trying to share an unshareable handle - as a result there's usually some associated discussion about how to share a handle...
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bduncan
PostPosted: Wed May 26, 2004 10:01 pm    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

Thanks for the clarification Jeff.
Just goes to show how something is right today, wrong tomorrow
_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Threading and Get with wait
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.