Search code examples
multithreadingapache-cameljconsole

Apache Camel - Browse Exchanges of a SEDA queue


I'm working on a small app which uses Apache Camel with JMX active. Very simply put, I have a route using SEDA component - just 1 consumer - which in a nutshell creates its own thread and queues incoming Exchanges if the route is busy.

Basically I'd like to monitor/browse/visualize the Exchanges that are waiting in the SEDA queue. I've tried Hawtio and JConsole with JMX but it only provides the number of total and current inflight exchanges on that given route. It doesn't mention the number of Exchanges waiting to be processed.

I've also tried the Browse component which keeps track of all exchanges being passed to the browse endpoint, however it keeps all the exchanges, as opposed as just the "queued" ones.

I'm wondering if there is something out-of-the-box in Camel which allows me to do this or if I overlooked something in Hawtio or JConsole.

Thanks in advance.


Solution

  • You can see on the SedaEndpoint mbean how many messages are in the queue. You can find those in the endpoints tree in hawtio, or also in plain JMX as well.

    @ManagedAttribute(description = "Current queue size") public int getCurrentQueueSize() { return queue.size(); }