Managed to solve this. It was actually relating to how one of the initial messages was added to the queue. It's submitted to another queue and is processed by an external system.
The point is, when I submit it to the input queue, when it's processed, a message is added to "status" and then the external system updates the "other" queue. The connection to the input queue was not closed. So even though the external system was doing all this other work, that initial connection I was holding open stops the "other" queue filter from working. Very strange. Especially since it's a stateless web service. On Tue, 10 Dec 2024, at 15:27, David Cole wrote: > Sorry. When i make that 2nd call to the 2nd queue for the correlation ID - > even though there is a message there I get a null message. > > If I strip out the code and just directly connect to the 2nd queue and pull a > message it is there. > > It is something in relation to one connection, or one consumer obtaining a > connection to one queue then switching to the 2nd queue. > > > On Tue, 10 Dec 2024, at 15:00, David Cole wrote: > > 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 > > > > > > >