开发者

activemq consumer enumeration

开发者 https://www.devze.com 2022-12-08 04:15 出处:网络
Is it possible to use an activemq consumer (in .NET) like this? foreach (var msg in consumer) { // process message开发者_如何学JAVA

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

精彩评论

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