开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜