I have a process where I am consuming a message on a "status" queue. I make connection to an ActiveMQ server, create a session, create a consumer to "status" with a JMSCorrelationID set, start the connection and receive a message.
Apache.NMS.IConnectionFactory factory = new Apache.NMS.ActiveMQ.ConnectionFactory(url); Apache.NMS.IConnection connection = factory.CreateConnection(); sessionConsume = connection.CreateSession(Apache.NMS.AcknowledgementMode.AutoAcknowledge); Apache.NMS.IDestination sourceQueue = sessionConsume.GetQueue("status"); string filter = string.Format("JMSCorrelationID='{0}'", correlationID); Apache.NMS.IMessageConsumer consumer = sessionConsume.CreateConsumer(sourceQueue,filter, true); connection.Start(); Apache.NMS.ITextMessage message = consumer.Receive(new TimeSpan(0, 0, ccMessageWait)) as Apache.NMS.ITextMessage; if (message != null) { //do something with the message } This works great. When there is no message there, however, I want it to check a 2nd queue. And here is where this gets unstuck. if (message != null) { //do somethign with the message } else { //Stop the current Connection, before opening again for OBQ //consumer.Close(); //consumer.Dispose(); //sourceQueue.Dispose(); //connection.Stop(); sourceQueue = sessionConsume.GetQueue("other"); consumer = sessionConsume.CreateConsumer(sourceQueue, filter, true); connection.Start(); message = consumer.Receive(new TimeSpan(0, 0, ccMessageWait)) as Apache.NMS.ITextMessage; if (message != null) { ///ideally there's a message here.....but alas. } } I've tried creating whole new connections, new consumers, new queue object (IDestination), I've tried stopping connection, then starting connection, disposing consumers etc. Basically I want to connect to "status" queue for that CorrelationID, and if nothing there, disconnect and connect to "other" queue, and expect to find a message there. Regards David --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@activemq.apache.org For additional commands, e-mail: users-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact