我正在尝试从 ActiveMQ 主题中接收消息。在 Web 控制台中,我看到许多消息在主题中排队,但运行以下代码不会返回任何内容:
IConnectionFactory factory = new ConnectionFactory(new Uri("tcp://localhost:61616?wireformat.version=2"));
using (IConnection connection = factory.CreateConnection())
{
connection.Start();
ISession session = connection.CreateSession();
ActiveMQTopic topic = new ActiveMQTopic("MARKETADAPTERS.ORDERBOOKSNAPSHOT");
consumer = session.CreateDurableConsumer(topic,"OBSnap",null, false);
message = (ActiveMQTextMessage)consumer.Receive(TimeSpan.FromSeconds(vTimeOutSecs));
}
任何提示将不胜感激。