You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Aneesh <cv...@yahoo.co.in> on 2011/06/06 15:23:21 UTC

Controlling Message generation based on ActiveMQ memory

Hi all,

I have a java class which produces the message and puts the message into the
queue.

I have a requirement where i should stop producing the message
programatically 
depending on the memory usage of ActiveMQ..

How can i achieve this?
Is it through Advisory Messages? Or is there any other way?
Kindly share any links/documentation which will help me..

Thanks
Aneesh

--
View this message in context: http://activemq.2283324.n4.nabble.com/Controlling-Message-generation-based-on-ActiveMQ-memory-tp3576900p3576900.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Controlling Message generation based on ActiveMQ memory

Posted by Aneesh <cv...@yahoo.co.in>.
@Torsten Mielke 

Ya that worked..
I obtained the 'brokerView' from the 'brokerService' instance using
'brokerView.getAdminView()'
Then i used the 'brokerView.getMemoryPercentUsage()' which gave me the
current memoru used buy the broker..I can now validate this percentage
against a threshold value and determine whether i should process the message
or not..

Thanks a lot for the guidance..

--
View this message in context: http://activemq.2283324.n4.nabble.com/Controlling-Message-generation-based-on-ActiveMQ-memory-tp3576900p3596483.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Controlling Message generation based on ActiveMQ memory

Posted by Torsten Mielke <to...@fusesource.com>.
Assuming you don't have many producers sending to the same destination,
your producer could connect to the broker via JMX and query the
MemoryPercentUsage property of the destination. If that is above 70% you
might skip the creation of the msg.
So JMX does expose this information. Other than that I am not sure there
is an alternative way.


Torsten Mielke
FuseSource

tmielke.blogspot.con



Re: Controlling Message generation based on ActiveMQ memory

Posted by Aneesh <cv...@yahoo.co.in>.
Thanks a lot for sharing the link.
I went through that and it seems all these end up at a point where the
producer may slowdown processing or throw an exception (like
ResourceAllocation Exception etc).

But the scenario what i am trying to avoid is the unwanted processing of
constructing the message..
All the configurations described in the link actually exposes the memory
issue only when the producer tries to send the message, not when it is
actually producing (constructing) the message..

In my scenario, the message construction is a lengthier process and I dont
want my system to unnecessary 
construct a message.System should execute the message generation process if
and only if it is clear that ActiveMQ has sufficient memory (ie say, should
not execute message generation process if the active mq usage is around 85%)

Is it possible for me to achieve this ? 
Awaiting replies.

--
View this message in context: http://activemq.2283324.n4.nabble.com/Controlling-Message-generation-based-on-ActiveMQ-memory-tp3576900p3576975.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Controlling Message generation based on ActiveMQ memory

Posted by Norman Maurer <no...@apache.org>.
You can do this via flow-control.

See:

http://activemq.apache.org/producer-flow-control.html

Bye,
Norman

Am 06.06.2011 15:23, schrieb Aneesh:
> Hi all,
>
> I have a java class which produces the message and puts the message into the
> queue.
>
> I have a requirement where i should stop producing the message
> programatically
> depending on the memory usage of ActiveMQ..
>
> How can i achieve this?
> Is it through Advisory Messages? Or is there any other way?
> Kindly share any links/documentation which will help me..
>
> Thanks
> Aneesh
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Controlling-Message-generation-based-on-ActiveMQ-memory-tp3576900p3576900.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.