0

ヘッダーを持つキュー内のすべてのメッセージを取得する方法 - "UniqueKey='Tomcat-User'" ,

MessageConsumer consumer = session.createConsumer(queue,"UniqueKey='Tomcat-User'");
message = consumer.receiveNoWait();
4

1 に答える 1

1

simply call consumer.receiveNoWait(); inside a loop:

Message message = null;
while((message = consumer.receiveNoWait()) != null);

This would consume all the available messages that matches the selector.

于 2013-02-03T12:43:37.227 に答える