How to get the number of messages in Mule ESB vm inbound endpoint Queue from the code?
Here is the configuration:
<vm:connector name="queue.vm.connector">
<vm:queue-profile maxOutstandingMessages="${oms.process.flow.max.queue.size}"/>
</vm:connector>
...
<flow name="Flow1"...
<vm:inbound-endpoint exchange-pattern="one-way" path="inbound_parcel.create.queue" responseTimeout="10000" mimeType="text/plain" connector-ref="queue.vm.connector" doc:name="Inbound Parcel Create Queue"/>
Thank you.
That can be achieved using the following custom code:
VMConnector vmConnector = (VMConnector) muleContext.getRegistry().lookupConnector("queue.vm.connector");
vmConnector.getQueueManager().getQueueSession().getQueue("inbound_parcel.create.queue").size();
If the queue if persistent the same result can be achieved by monitoring the folder where message are stored:
${MULE_HOME}/.mule/${app.name}/queuestore/inbound_parcel.create.queue
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.