ESB: ActiveMQ : Queue's Message count

Six Stars

ESB: ActiveMQ : Queue's Message count


I am using Talend ESB enterprise edition. 


My requirement is to peek into a queue (ActiveMQ) to know if the queue is empty. I want to take some action based on if the queue is empty.

1. Is there a way to get Queue's message count with in a Route? this talks about ActiveMQ plugin for Hyperic. But I do not understand if that helps in getting the message count with in a Route. If so, what ESB component can help me read the message count?


2. Can I have a ActiveMQ consumer that can just peek the message, but not removing it from the queue?






Thirteen Stars

Re: ESB: ActiveMQ : Queue's Message count

not sure how it could work in route, but generally You can use REST interface of ActiveMQ for request many information




return You:

  "request": {
    "mbean": "org.apache.activemq:brokerName=localhost,destinationName=TEST,destinationType=Queue,type=Broker",
    "type": "read"
  "value": {
    "ProducerFlowControl": true,
    "AlwaysRetroactive": false,
    "Options": "",
    "MemoryUsageByteCount": 4376,
    "AverageBlockedTime": 0.0,
    "MemoryPercentUsage": 0,
    "CursorMemoryUsage": 4376,
    "InFlightCount": 4,
    "Subscriptions": [
        "objectName": "org.apache.activemq:brokerName=localhost,clientId=ID_VA-iMac.local-53650-1505260517761-3_3,consumerId=ID_VA-iMac.local-53650-1505260517761-4_3_1_1,destinationName=TEST,destinationType=Queue,endpoint=Consumer,type=Broker"
    "CacheEnabled": true,
    "DLQ": false,
     ..... skipped
    "MaxPageSize": 200,
    "QueueSize": 4,
    "PrioritizedMessages": false,
    "MemoryUsagePortion": 1.0,
    ..... skipped
    "SlowConsumerStrategy": null
  "timestamp": 1505261888,
  "status": 200

JOSN, where QueueSize - it is exactly what are You looking for
of course You need add authorisation parameters - basic HTTP authorisation