Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Thread Affinity and MQ 1

Status
Not open for further replies.

Hexonx

Programmer
Jan 10, 2001
102
US
Are message queues particular about the threads that access them? In my experience, I receive an error when accessing a queue from a different thread than the one that opened the queue. This isn't a major issue, but I keep bumping into it when trying to build my queue access component. My queue access needs to continue trying when the queues are down (I used to just shut down my application), operate with a client-specified timeout, be cancel-able by the client, and support transactions. Because I access the queues on a separate thread (to support asynchronous gets/puts, and allow cancellation), I keep bumping into the affinity problem when either reading a Get or concluding a transaction.

I'm accessing MQ 5.3 with IBM's .NET assembly, if this has anything to do with the issue. I just wanted to throw this on the table for discussion.
 
All of the MQ activity has to take place under the same connection handle. That handle is associated with the thread. If you MQ connect in one program you cannot use that connection handle in a called program. On z/OS you can substitute 'TCB' for 'thread'. In .NET you should be able to pass the connection handle between subroutines without a problem, just not between two different programs.

Hope this helps
 
Good info, thanks. I've finished the code that performs Gets and Puts in both synchronous and asynchronous modes, and also supports MQ transactions in each mode. I wish I could post it somewhere. Maybe I'll write an article on one of the dev sites.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top