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 IBM MQ Support » file descriptor and select() for MQ

Post new topic  Reply to topic
 file descriptor and select() for MQ « View previous topic :: View next topic » 
Author Message
skytorch
PostPosted: Tue Jul 23, 2002 10:06 am    Post subject: file descriptor and select() for MQ Reply with quote

Apprentice

Joined: 10 Jun 2002
Posts: 47
Location: New York City

Hi,

We've a MQ Client in C that use MQ5.2 QM on solaris 7. This client is a single threaded to read from a socket connection and a app queue Q1.

If a message comes from the socket, it'll send message to some app queues; if a message comes to Q1, it'll send it to the socket connection.

Since the application is single threaded, in order to improve the system performance, both reads from socket and Q1 should better be in non-block manner.

I wonder if I can use unix select(<file descriptors>) to monitor both socket connection and a Q1 within one thread. If a message shows up in either one, I can process it.

Is it do-able with MQ Queue ?

Thanks.

Sky
Back to top
View user's profile Send private message
kolban
PostPosted: Tue Jul 23, 2002 11:13 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

Unfortunately not. If you could allow yourself to be multi-threaded, you could have a thread that blocks on the socket and a thread that blocks on the queue with an MQGET call. Unfortunately, there is no asynchronous delivery mechanism to notify you that a message is available when you do an MQGET call.

You could do a blocking MQGET call with a small delay (say 1000 ms or less) and, if awoken because there was no message, then do a block on the socket for a 1000 ms and repeat.

This would be a loose kind of polling but not so inefficient that the resources consumed would be too high.

You could also go multi-process if multi-threading isn't possible. Have a second, demon program, block indefinietly on the queue and, when a message is available, consume the message and then send it down a socket to be consumed by the blocked main thread/process.
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 IBM MQ Support » file descriptor and select() for MQ
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.