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 » MQI calls in multi threaded application

Post new topic  Reply to topic
 MQI calls in multi threaded application « View previous topic :: View next topic » 
Author Message
xgnitesh
PostPosted: Wed Jul 02, 2008 5:02 am    Post subject: MQI calls in multi threaded application Reply with quote

Novice

Joined: 06 Sep 2005
Posts: 19


Hi all,

I have an application that uses 2 queues to communicate to a server. One input queue and another output queue. I have 2 threads in my program. The worker thread keeps calling MQGET on the input queue in a loop with a wait interval of 10 seconds. When a message arrives, it updates the UI with the information. The UI thread based on user interaction keeps sending requests to the server through the output queue. The server can keep sending updates even without requests from the application and UI is supposed to show it without any delay.

I tried same thing in .NET (IBM.MQI) and then using C API.

Using .NET:

I opened the MQ connection in the worker thread. The same connection object was used for Get calls in the worker thread, as well as Put calls from the UI thread. This worked in the .NET program using IBM.MQI but putting the message in the output queue from UI thread took a few seconds to return. When I changed the wait interval of the Get call in worker thread to zero, there was no delay in MQPUT and it returned immediately but there was a lot of undesirable network traffic due to continuous Get calls. I don’t want to use a wait interval of less than 10 seconds to minimize network traffic.

Using C API:

When I did the same stuff in a C++ program, it gives an invalid connection handle in the UI thread.

I need to make an interactive application without any visible delays to the user while sending and receiving messages to the server.

Can anyone please explain me how MQ connections creation, getting and putting should be done in 2 different threads so that one thread can keep sending messages to a queue and another thread can keep receiving messages from another queue without introducing a delay?

Thanks in advance for any help on this!

Nitesh
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
zpat
PostPosted: Wed Jul 02, 2008 6:03 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Use MQCONN in each thread to give complete independence with their own handles.

Or using handle sharing but this will have some limitations especially if you have MQGET with WAIT.
Back to top
View user's profile Send private message
xgnitesh
PostPosted: Sun Jul 06, 2008 9:59 pm    Post subject: Reply with quote

Novice

Joined: 06 Sep 2005
Posts: 19

Thanks a lot! I tried separate connections for each thread in .NET and it works.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » MQI calls in multi threaded application
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.