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 » Opening more than one queuemanager in a single thread (.NET)

Post new topic  Reply to topic
 Opening more than one queuemanager in a single thread (.NET) « View previous topic :: View next topic » 
Author Message
Henk-Jan Visscher
PostPosted: Mon Dec 13, 2004 8:21 am    Post subject: Opening more than one queuemanager in a single thread (.NET) Reply with quote

Novice

Joined: 12 Nov 2004
Posts: 10
Location: Amsterdam

Hello,

I'm developing a .NET program that copies messages from one MQ queue to another MQ queue. In one thread, two queues are opened (one for input, one for output), followed by a get from the input queue and a put at the output queue.

One of these MQ queues is wrapped by a library of another software developer. The opening of the MQ queue in the library of the other software developer doesn't work, it throws an HCONN_ERROR exception when I'm trying to open the queue.

According to the other company that provides the library, MQ doesn't support handling more than one queue manager in a single thread:

Quote:

Scope of MQCONN or MQCONNX

WithinWebSphere MQ for iSeries, MQSeries for Compaq OpenVMS Alpha, MQSeries for OS/2 Warp, WebSphere MQ on UNIX systems and WebSphere MQ for Windows, the scope of an MQCONN or MQCONNX call is usually the thread that issued it. That is, the connection handle returned from the call is valid only within the thread that issued the call. Only one call may be made at any one time using the handle. If it is used from a different thread, it will be rejected as invalid. If you have multiple threads in your application and each wishes to use WebSphere MQ calls, each one must individually issue MQCONN or MQCONNX.

Each thread can connect to a different queue manager using MQCONN or MQCONNX on OS/2 and Windows systems, but not on OS/400 or UNIX.

If your application is running as a client, it may connect to more than one queue manager within a thread.


According to this information, it only says a client application cannot connect to more that one queue manager in a thread. Does this also imply the reverse, e.g. you can't connect to more than one queue manager in a single thread if the application is running as a server?

Is there a workaround for this problem? Has anyone experienced this problem before.

If I write a small program using MQ queues only, it works without any problems. Does this mean it doesn't occur when using the .NET library?

Any help would be greatly appreciated,
Henk-Jan.
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Mon Dec 13, 2004 9:48 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Quote:
According to this information, it only says a client application cannot connect to more that one queue manager in a thread. Does this also imply the reverse, e.g. you can't connect to more than one queue manager in a single thread if the application is running as a server?

I believe you have this backwards. Note, I have done minimal stuff with .NET but in other languages using the MQ API, it is the 'client mode' that allows you to have multiple connections open.

In binding mode (aka server), you can only ever do one connection per thread.

Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
Henk-Jan Visscher
PostPosted: Mon Dec 13, 2004 11:02 am    Post subject: Reply with quote

Novice

Joined: 12 Nov 2004
Posts: 10
Location: Amsterdam

Quote:
I believe you have this backwards. Note, I have done minimal stuff with .NET but in other languages using the MQ API, it is the 'client mode' that allows you to have multiple connections open.


You're right, I got it backwards. I meant a server application.

So how should I implement this? And why does it work when I use the .NET libraries?
Back to top
View user's profile Send private message
vennela
PostPosted: Mon Dec 13, 2004 12:57 pm    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

I think it depends on the platforms also.
Since this is .net, then the QMGRs if being used in bindings mode then will exist on windows platform. So, you should be able to connect to multiple QMGRs within the same thread.

I tested this using Java app (and it works) and I am not sure about .NET

http://www.mqseries.net/phpBB2/viewtopic.php?t=13295&highlight=mqpgmto2qmgrs
Back to top
View user's profile Send private message Send e-mail Visit poster's website
fjb_saper
PostPosted: Mon Dec 13, 2004 2:51 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

There is a little work around to this.
If there is a client connection allowing you to connect to the second qmgr from the first one, then there is a chance that you could connect to the other qmgr from within the application but using a different thread.

But you just want to keep it safe and follow what the manual said.

Enjoy
Back to top
View user's profile Send private message Send e-mail
Henk-Jan Visscher
PostPosted: Tue Dec 14, 2004 3:33 am    Post subject: Reply with quote

Novice

Joined: 12 Nov 2004
Posts: 10
Location: Amsterdam

Thanks for all the info.

Quote:
vennela I tested this using Java app (and it works) and I am not sure about .NET

I had no problems using multiple connecties (up to three different queue managers in .NET), so I assume it depends upon the platform. The other library is written in C, not in .NET. Maybe this explains it.
Quote:
fjb_saper: If there is a client connection allowing you to connect to the second qmgr from the first one, then there is a chance that you could connect to the other qmgr from within the application but using a different thread.

Putting the message in another thread is not possible because the put and the get should be performed in one transaction.

So it seems I'll have to put the messages in a database first, and then get and put them using another thread. Seems like a very contact admin workaround. Does anybody has a better idea?
Back to top
View user's profile Send private message
zpat
PostPosted: Tue Dec 14, 2004 5:09 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Connecting to multiple queue managers from a single application generally indicates that your MQ infrastructure is not set up correctly.

An application should have a "home" queue manager (which may be local or via a client connection).

If it needs to receive messages from another queue manager then a queue on that queue manager should be defined as a remote queue to the "home" queue manager.

If it needs to send messages to another queue manager then define a queue on the "home" queue manager as a remote queue to the other one.

I know this sounds like basic stuff but this does sound like a problem of your own making!
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 API Support » Opening more than one queuemanager in a single thread (.NET)
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.