PAA
PAA

Reputation: 11985

Only consume few messages from the Topic or Queue of Tibco EMS

My understanding is that consumer by default consumes all the messages from the Topic or Queue. We're using Tibco EMS in our project, what we're looking to always consume 1st message or 1st 10 messages only by giving the certain numbers, so that only those number of messages can be consumed.

How can we do that in Tibco EMS?

Upvotes: 1

Views: 117

Answers (1)

David Abragimov
David Abragimov

Reputation: 544

You can try to use QueueInfo class and check for the pendingmessages or totalmessages before reading the Queue\Topic. Please note that TotalMessageCount statistics should be enabled in EMS and statistics will be reset after the server restart.

TibjmsAdmin connection = new TibjmsAdmin(url,username,password);
QueueInfo info = connection.getQueue(queue);
//messages = info.getPendingMessageCount();
messages  = info.getInboundStatistics().getTotalMessages();
connection.close();

enter image description here

Upvotes: 0

Related Questions