ESB: ActiveMQ : Queue's Message count

Six Stars

ESB: ActiveMQ : Queue's Message count

Hi,

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? 

https://help.talend.com/reader/uIKVtnSbP9Sodkc3AE3_6w/U8aUhCtLmxEVvkAoFwqpmQ 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?

 

Thanks,

Sowjanya.

 

 

Highlighted
Forteen 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

 

example:

http://localhost:8161/api/jolokia/read/org.apache.activemq:type=Broker,brokerName=localhost,destinationName=TEST,destinationType=Queue

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

-----------

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read