Monitoring - Get First message of Broker CLient queue


For monitoring purposes I would like to have a Java service which would get the first message in a client queue. (of course without deleting it from the client queue).

Then once I have the document in IDATA in flow service I can filter from the _env the enqueueTime.

I’m guessing that the Broker Java API is the way to go for this.
Something like :

Browse client queue
Set position to 1
Get the document

Can anyone help providing a sample Java code for this?

Thanks a lot for your eventual help.



Were you able to write your java service to get the actual message that is stuck in the client queued? If so, do you mind sharing?



I was able to get the metadata of the document but until now could not get the Data itself, the content of the document.

For me until now, the important was to get the “age” field to know how long it was in the queue and monitor/alert if above threshold.

This is now done and will be happy to share the code.

But to get the actual document, I was not able.



Thank you Jeremy. I was able to get only the metadata too (_env part of the message). I have gone through the Broker JAVA API so many times but it just does not work :frowning: Does anyone out there knows how or even possible to get the actual message that is stuck in the client queued?


I managed to finally do this using the QueueBrowser java class.
You just need to then convert the BrokerEvent into a string using the toString() and then extract the data.
You can also get the data by getting the value of the IData Field name…

BTS this does not wotk with DeadLetter queue !!


could you pl. share the code with me @