ActiveMQ with C# and Apache NMS - Count messages in queue

后端 未结 1 1057
余生分开走
余生分开走 2020-12-11 10:44

I\'m using ActiveMQ to send and receive messages using a C# app. However I\'m having some difficulty just getting a count of the messages in the queue.. Here\'s my code:

1条回答
  •  南方客
    南方客 (楼主)
    2020-12-11 11:30

    I don't have an ActiveMq with me right now so I can not try it but I think the problem is you are not starting the connection. Try like this :

    using (IConnection connection = factory.CreateConnection())
    {
        connection.start ();
    
         using (ISession session = connection.CreateSession())
         {
          //Whatever...
         }
    
    }
    

    0 讨论(0)
提交回复
热议问题