Programmatically reading ActiveMQ.Advisory.xyz topics

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Programmatically reading ActiveMQ.Advisory.xyz topics

mclaudio76
Hi there,

I just want to read ActiveMQ.Advisory.xyz topics programmatically and try to log them on a database for further analysis. The problem is that I don't want to create a listener so that I can receive and log messages as they arrive; I want just connect to the topic at a given moment and read them one by one. Is there a way to achive this ?
Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically reading ActiveMQ.Advisory.xyz topics

Tim Bain
Create (and connect) a durable subscriber.  Then you can disconnect it
whenever you want, and when you reconnect it will get all the messages it
missed while it was disconnected.  That will let you get all the messages,
without having to be connected the whole time.

A word of warning: if you have LOTS of advisory messages and your
subscriber is disconnected for a long time, all of those unconsumed
messages will cause the broker's memory usage to go up until eventually the
broker hits the message store limits and flow control producers (which will
be the broker or other brokers in the network, and I have no idea what
happens if you flow control the broker itself) or maybe it'll even run out
of memory.  These aren't super-likely, but you should still make sure you
evaluate your message rate and message store limits to know how long you
can afford to have your consumer offline.  And when you're done with your
monitoring, make sure you unsubscribe, for the same reason.
On Dec 28, 2014 10:06 AM, "mclaudio76" <[hidden email]>
wrote:

> Hi there,
>
> I just want to read ActiveMQ.Advisory.xyz topics programmatically and try
> to
> log them on a database for further analysis. The problem is that I don't
> want to create a listener so that I can receive and log messages as they
> arrive; I want just connect to the topic at a given moment and read them
> one
> by one. Is there a way to achive this ?
> Thanks in advance.
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Programmatically-reading-ActiveMQ-Advisory-xyz-topics-tp4689299.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Programmatically reading ActiveMQ.Advisory.xyz topics

mclaudio76
This post was updated on .
Hi tbain98,

thanks a lot for your reply. So, the only way to read those advisory messages is to create a subscriber; that's ok for me. I've noticed that if I restart the broker (and I'm going to perform such operation at every sunday midnight) Advisory topics & queues are automatically cleaned up, so I think that for my working scenario I'd better :
a) create a not-durable subscriber, using wildcards so that I can receive each advisory message even for topics / queues that ActiveMQ creates on the fly (at least, It should work...)
b) keep my subscriber always connected, avoid the potential problem you described in your email: at the moment I need only to purge those messages.

Thanks again for your help !