Note that there are some explanatory texts on larger screens.

plurals
  1. POReconnecting with MQ - issues
    text
    copied!<p>I'm looking forward to implement a somewhat intelligent MQ comms module, which should be tolerant for the outages in the network connection. Basically it should try to reconnect each 5 seconds if connection was lost. </p> <p>The problem is the following. I use the following code for reading: </p> <pre><code>queueMessage = new MQMessage(); queueMessage.Format = MQC.MQFMT_STRING; queueGetMessageOptions = new MQGetMessageOptions(); queueGetMessageOptions.Options = MQC.MQGMO_SYNCPOINT + MQC.MQGMO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING; queueGetMessageOptions.WaitInterval = 50; producerQueue.Get(queueMessage, queueGetMessageOptions); msg = queueMessage.ReadBytes(queueMessage.MessageLength); </code></pre> <p>(Of course I successfully connect to the queuemanager before etc.)<br> I got the following issue: when this routine runs, but at the time of <code>.Get</code> there's no connection, the code simply hangs and stays in the <code>.Get</code>. I use a timer to see if there's a timeout (in theory even that shouldn't be necessary, is that right?) and at the timeout I try to reconnect. BUT when this timeout expires, I still see that the queuemanager reports that it's connected, while its clearly not (no physical connection is present anymore). This issue has popped up since I use SYNCPOINT, and I experience the same when I cut connection during writing, or in this case I try to force a Disconnect on the queuemanager. So please help, what settings shall I use to avoid getting stuck in <code>Get</code> and <code>Put</code> and rather have an <code>MQException</code> thrown or something controllable? Thanks!</p> <p>UPDATE: I used the following code to connect to the QueueManager.</p> <pre><code>Hashtable props = new Hashtable(); props.Add(MQC.HOST_NAME_PROPERTY, Host); props.Add(MQC.PORT_PROPERTY, Port); props.Add(MQC.CHANNEL_PROPERTY, ChannelInfo); if(User!="") props.Add(MQC.USER_ID_PROPERTY, User); if(Password!="") props.Add(MQC.PASSWORD_PROPERTY, Password); props.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED); queueManager = new MQQueueManager(QueueManagerName, props); producerQueue = queueManager.AccessQueue( ProducerQueueName, MQC.MQOO_INPUT_AS_Q_DEF // open queue for input + MQC.MQOO_FAIL_IF_QUIESCING); // but not if MQM stopping consumerQueue = queueManager.AccessQueue( ConsumerQueueName, MQC.MQOO_OUTPUT + MQC.MQOO_BROWSE + MQC.MQOO_INPUT_AS_Q_DEF // open queue for output + MQC.MQOO_FAIL_IF_QUIESCING); // but not if MQM stopping </code></pre> <p>Needless to say that normally the code works well. Read/Write, connect/disconnect works as it should, I only have to figure out the current issue. Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload