I have a question about the REST API and Selectors.  I was trying to use the 
REST API to process messages from a queue using a Selector against the 
JMSTimestamp setting.  No matter what I tried, it seemed to ignore the 
selector.  I am now trying a Java consumer route, but was curious why the REST 
API wouldn't work.

I tried using the  "Consuming with selectors" example that I found on 
https://activemq.apache.org/rest.  I tried both wget and curl and it seems to 
ignore the selector. Is there any magic trick to sending the selector when 
using the REST API?

The use case is the following: we are using a virtual destination to 
essentially create an audit type queue so that we have a record of the messages 
that are processed through the queue. This helps with troubleshooting issues. 
Over time, that audit queue grows.  My goal is to keep the most recent 30-60 
days of those audit messages and remove the rest from that queue.  I was hoping 
to write a simple script that I could run on cron once a week/once a month to 
cleanup the audit queues.  Otherwise, they just keep growing and consume the 
disk space.

I have the following in a shell script file (variables do get resolved via the 
script)

CHECK_RETURN=`curl -s --header "selector: JMSTimestamp<1663113600000"  -XGET 
--netrc-file ${SCRIPT_NETRC_FILENAME} 
${ACTIVE_MQ_HOST_URL}:${queue_port}/api/message/MY_QUEUE_Backup?readTimeout=1000\&type=queue\&clientId=cleanupConsumer`

If I run in verbose mode, I can see that the header is being sent, but it 
doesn't seem to obey it.

I inherited the support of the Queue and based on reading over the past couple 
of days, we probably need to look at TTL and the like.  In the meantime, I am 
curious if anyone has any suggestions on using the selector with the REST API.

Thanks for any suggestions anyone has. I spent a long time trying to get it to 
work and tried multiple things (-H instead of -header, different quoting, epoch 
time format vs milliseconds since epoch, etc.)  Now I am just curious as to why 
it wouldn't work.

I tried searching the archives, but I didn't see anything. Several Google 
searches did not provide anything useful either.

Thanks,

Michael

Reply via email to