Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以像这样使用 activemq 消费者(在 .NET 中)?
foreach(消费者中的var msg){
// 处理消息
}
这样枚举循环会停止,而不消耗 CPU,直到有消息可用?实际上,除非出现问题,否则它将是一个无限循环。
您可以使用 while 循环执行同步消费以实现类似的效果:
IMessage message = null; while((message = consumer.Receive()) != null) { //... process the message. }
-蒂姆 www.fusesource.com