activemq consumer enumeration
Is it possible to use an activemq consumer (in .NET) like this?
foreach (var msg in consumer) {
// process message
开发者_如何学JAVA}
such that the enumeration loop stops, without consuming CPU, until a message is available? Effectively it would be an infinite loop unless something goes wrong.
You can perform a synchronous consume to achieve something like this with a while loop:
IMessage message = null;
while((message = consumer.Receive()) != null)
{
//... process the message.
}
-Tim www.fusesource.com
精彩评论