ActiveMQ的.NET客户端锁死 [英] ActiveMQ .net client locks up
问题描述
我已经写了使用Apache.NMS和Apcahe.NMS.ActiveMQ(版本1.0)库窗口服务。该服务由供应商服务器消耗来自ActiveMQ的消息。
I have written a windows service using the Apache.NMS and Apcahe.NMS.ActiveMQ (version 1.0) libraries. The service consumes messages from ActiveMQ from a vendor server.
服务旋转起来的连接和监听消息(我处理的onMessage事件)
The service spins up a connection and listens for messages (I handle the OnMessage event)
的连接是事务性的连接,所以我呼吁每封邮件后提交。
The connection is a transacted connection so I call commit after each message.
在启动服务之后,一切工作得很好,这样做了一段时间。然而,在已经运行了一段时间,这将不再使用消息。即使我重置服务。它通常需要我服务的重新启动和供应商的服务器(Tomcat)的,把事情去了。供应商坚持认为,没有什么是错在他们一边。
When the service starts up, everything works very well and does so for a while. However, after it has run for a while, it will no longer consume messages. Even if I reset the service. It usually takes a restart of my service AND the vendor server (tomcat) to get things going again. The vendor insists that nothing is wrong on their side.
没有异常抛出任何一方(客户端或服务器) - 它只是停留
No exceptions are thrown on either side (client or server) - it's just 'stuck'.
我应该考虑使用Spring.Messaging.Nms?
Should I consider using Spring.Messaging.Nms?
推荐答案
我已经发现了这个问题。建立连接和消息侦听器后,在服务进入与Thread.sleep代码(500)的循环。哑。我重构了服务启动一切都在OnStart中和的onStop处置。
I have discovered the problem. After establishing the connection and the message listener the service went into a loop with Thread.Sleep(500). Dumb. I refactored the service to start everything up in OnStart and dispose of it in OnStop.
由于这样做,一切都运行完美。
Since doing that, everything is running perfectly.
键盘和椅子之间发生的经典ID-10-T的错误。
Classic ID-10-T error occurring between keyboard and chair.
这篇关于ActiveMQ的.NET客户端锁死的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!