You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jeremy Levy <je...@gmail.com> on 2011/06/01 15:51:49 UTC

Patch to disable all Queues

We currently deploy our ActiveMQ enabled Message Driven Beans along with our
larger application inside of an EAR file.  This ear file is then deployed
across multiple application servers.  However we only wanted consumers to be
active on certain dedicated servers.  I wasn't able to find a solution
within ActiveMQ that allows us to globally turn off consumers at deployment.
 For a while we were tweaking the consumers via JMX but that was problematic
and could only be done after the consumer was activated and started
processing.

I built our own activemq-rar-5.4.2.rar with the following modifications:

In ActiveMQResourceAdapter.java, public void
endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec
activationSpec)

Before creating the worker and checking to see if it previously activated a
quick system property check:

if (!Boolean.valueOf(System.getProperty("activemq.endpoints.disabled",
"false"))) {...


If true, dont' actually enable any queues etc.  I'm not sure this is the
best method but it seems to be working.  I've included a patch for the 5.4.2
branch.  I can prepare one for the trunk if the developers think this would
be a worthwhile contribution.

Jeremy

-- 
Jeremy Levy

Re: Patch to disable all Queues

Posted by Jeremy Levy <je...@gmail.com>.
Thanks Gary.  See https://issues.apache.org/jira/browse/AMQ-3368

On Fri, Jun 3, 2011 at 6:44 PM, Gary Tully <ga...@gmail.com> wrote:

> Think so, it has low impact and gives you value, so go ahead.
> On 3 Jun 2011 20:22, "Jeremy Levy" <je...@gmail.com> wrote:
> > Is this useful enough for me to submit a JIRA ticket with the patch?
> >
> > On Wed, Jun 1, 2011 at 1:25 PM, Jeremy Levy <je...@gmail.com> wrote:
> >
> >> Gary-
> >>
> >> Right, exclusive consumer won't work as I still want to have multiple
> >> consumers.
> >>
> >> I don't have a requirement to start these consumers after the container
> is
> >> started, you would have to change the system property and redeploy your
> app
> >> or restart your container.
> >>
> >> I'm not that familiar with using properties via jmx/mbean, I followed a
> >> similar pattern using the system property that other tools like Ehcache
> and
> >> Terrcotta use for controlling some global functionality.
> >>
> >> Jeremy
> >>
> >>
> >> On Wed, Jun 1, 2011 at 10:38 AM, Gary Tully <ga...@gmail.com>
> wrote:
> >>
> >>> interesting, I guess the "exclusive consumer" feature won't cut it as
> >>> you are limited to a single consumer.
> >>>
> >>> How do those consumers eventually get activated, is a restart of the
> >>> container without the property?
> >>>
> >>> Would it make sense to have the property settable via jmx, so an mbean
> >>> on the resource adapter?
> >>>
> >>> On 1 June 2011 14:51, Jeremy Levy <je...@gmail.com> wrote:
> >>> > We currently deploy our ActiveMQ enabled Message Driven Beans along
> with
> >>> our
> >>> > larger application inside of an EAR file. This ear file is then
> >>> deployed
> >>> > across multiple application servers. However we only wanted consumers
> >>> to be
> >>> > active on certain dedicated servers. I wasn't able to find a solution
> >>> > within ActiveMQ that allows us to globally turn off consumers at
> >>> deployment.
> >>> > For a while we were tweaking the consumers via JMX but that was
> >>> problematic
> >>> > and could only be done after the consumer was activated and started
> >>> > processing.
> >>> > I built our own activemq-rar-5.4.2.rar with the following
> modifications:
> >>> > In ActiveMQResourceAdapter.java, public void
> >>> > endpointActivation(MessageEndpointFactory endpointFactory,
> >>> ActivationSpec
> >>> > activationSpec)
> >>> > Before creating the worker and checking to see if it previously
> >>> activated a
> >>> > quick system property check:
> >>> >
> >>> > if
> (!Boolean.valueOf(System.getProperty("activemq.endpoints.disabled",
> >>> > "false"))) {...
> >>> >
> >>> > If true, dont' actually enable any queues etc. I'm not sure this is
> the
> >>> > best method but it seems to be working. I've included a patch for the
> >>> 5.4.2
> >>> > branch. I can prepare one for the trunk if the developers think this
> >>> would
> >>> > be a worthwhile contribution.
> >>> > Jeremy
> >>> > --
> >>> > Jeremy Levy
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>> http://fusesource.com
> >>> http://blog.garytully.com
> >>>
> >>
> >>
> >>
> >> --
> >> Jeremy Levy
> >>
> >
> >
> >
> > --
> > Jeremy Levy
>



-- 
Jeremy Levy

Re: Patch to disable all Queues

Posted by Gary Tully <ga...@gmail.com>.
Think so, it has low impact and gives you value, so go ahead.
On 3 Jun 2011 20:22, "Jeremy Levy" <je...@gmail.com> wrote:
> Is this useful enough for me to submit a JIRA ticket with the patch?
>
> On Wed, Jun 1, 2011 at 1:25 PM, Jeremy Levy <je...@gmail.com> wrote:
>
>> Gary-
>>
>> Right, exclusive consumer won't work as I still want to have multiple
>> consumers.
>>
>> I don't have a requirement to start these consumers after the container
is
>> started, you would have to change the system property and redeploy your
app
>> or restart your container.
>>
>> I'm not that familiar with using properties via jmx/mbean, I followed a
>> similar pattern using the system property that other tools like Ehcache
and
>> Terrcotta use for controlling some global functionality.
>>
>> Jeremy
>>
>>
>> On Wed, Jun 1, 2011 at 10:38 AM, Gary Tully <ga...@gmail.com> wrote:
>>
>>> interesting, I guess the "exclusive consumer" feature won't cut it as
>>> you are limited to a single consumer.
>>>
>>> How do those consumers eventually get activated, is a restart of the
>>> container without the property?
>>>
>>> Would it make sense to have the property settable via jmx, so an mbean
>>> on the resource adapter?
>>>
>>> On 1 June 2011 14:51, Jeremy Levy <je...@gmail.com> wrote:
>>> > We currently deploy our ActiveMQ enabled Message Driven Beans along
with
>>> our
>>> > larger application inside of an EAR file. This ear file is then
>>> deployed
>>> > across multiple application servers. However we only wanted consumers
>>> to be
>>> > active on certain dedicated servers. I wasn't able to find a solution
>>> > within ActiveMQ that allows us to globally turn off consumers at
>>> deployment.
>>> > For a while we were tweaking the consumers via JMX but that was
>>> problematic
>>> > and could only be done after the consumer was activated and started
>>> > processing.
>>> > I built our own activemq-rar-5.4.2.rar with the following
modifications:
>>> > In ActiveMQResourceAdapter.java, public void
>>> > endpointActivation(MessageEndpointFactory endpointFactory,
>>> ActivationSpec
>>> > activationSpec)
>>> > Before creating the worker and checking to see if it previously
>>> activated a
>>> > quick system property check:
>>> >
>>> > if (!Boolean.valueOf(System.getProperty("activemq.endpoints.disabled",
>>> > "false"))) {...
>>> >
>>> > If true, dont' actually enable any queues etc. I'm not sure this is
the
>>> > best method but it seems to be working. I've included a patch for the
>>> 5.4.2
>>> > branch. I can prepare one for the trunk if the developers think this
>>> would
>>> > be a worthwhile contribution.
>>> > Jeremy
>>> > --
>>> > Jeremy Levy
>>> >
>>>
>>>
>>>
>>> --
>>> http://fusesource.com
>>> http://blog.garytully.com
>>>
>>
>>
>>
>> --
>> Jeremy Levy
>>
>
>
>
> --
> Jeremy Levy

Re: Patch to disable all Queues

Posted by Jeremy Levy <je...@gmail.com>.
Is this useful enough for me to submit a JIRA ticket with the patch?

On Wed, Jun 1, 2011 at 1:25 PM, Jeremy Levy <je...@gmail.com> wrote:

> Gary-
>
> Right, exclusive consumer won't work as I still want to have multiple
> consumers.
>
> I don't have a requirement to start these consumers after the container is
> started, you would have to change the system property and redeploy your app
> or restart your container.
>
> I'm not that familiar with using properties via jmx/mbean, I followed a
> similar pattern using the system property that other tools like Ehcache and
> Terrcotta use for controlling some global functionality.
>
> Jeremy
>
>
> On Wed, Jun 1, 2011 at 10:38 AM, Gary Tully <ga...@gmail.com> wrote:
>
>> interesting, I guess the "exclusive consumer" feature won't cut it as
>> you are limited to a single consumer.
>>
>> How do those consumers eventually get activated, is a restart of the
>> container without the property?
>>
>> Would it make sense to have the property settable via jmx, so an mbean
>> on the resource adapter?
>>
>> On 1 June 2011 14:51, Jeremy Levy <je...@gmail.com> wrote:
>> > We currently deploy our ActiveMQ enabled Message Driven Beans along with
>> our
>> > larger application inside of an EAR file.  This ear file is then
>> deployed
>> > across multiple application servers.  However we only wanted consumers
>> to be
>> > active on certain dedicated servers.  I wasn't able to find a solution
>> > within ActiveMQ that allows us to globally turn off consumers at
>> deployment.
>> >  For a while we were tweaking the consumers via JMX but that was
>> problematic
>> > and could only be done after the consumer was activated and started
>> > processing.
>> > I built our own activemq-rar-5.4.2.rar with the following modifications:
>> > In ActiveMQResourceAdapter.java, public void
>> > endpointActivation(MessageEndpointFactory endpointFactory,
>> ActivationSpec
>> > activationSpec)
>> > Before creating the worker and checking to see if it previously
>> activated a
>> > quick system property check:
>> >
>> > if (!Boolean.valueOf(System.getProperty("activemq.endpoints.disabled",
>> > "false"))) {...
>> >
>> > If true, dont' actually enable any queues etc.  I'm not sure this is the
>> > best method but it seems to be working.  I've included a patch for the
>> 5.4.2
>> > branch.  I can prepare one for the trunk if the developers think this
>> would
>> > be a worthwhile contribution.
>> > Jeremy
>> > --
>> > Jeremy Levy
>> >
>>
>>
>>
>> --
>> http://fusesource.com
>> http://blog.garytully.com
>>
>
>
>
> --
> Jeremy Levy
>



-- 
Jeremy Levy

Re: Patch to disable all Queues

Posted by Jeremy Levy <je...@gmail.com>.
Gary-

Right, exclusive consumer won't work as I still want to have multiple
consumers.

I don't have a requirement to start these consumers after the container is
started, you would have to change the system property and redeploy your app
or restart your container.

I'm not that familiar with using properties via jmx/mbean, I followed a
similar pattern using the system property that other tools like Ehcache and
Terrcotta use for controlling some global functionality.

Jeremy

On Wed, Jun 1, 2011 at 10:38 AM, Gary Tully <ga...@gmail.com> wrote:

> interesting, I guess the "exclusive consumer" feature won't cut it as
> you are limited to a single consumer.
>
> How do those consumers eventually get activated, is a restart of the
> container without the property?
>
> Would it make sense to have the property settable via jmx, so an mbean
> on the resource adapter?
>
> On 1 June 2011 14:51, Jeremy Levy <je...@gmail.com> wrote:
> > We currently deploy our ActiveMQ enabled Message Driven Beans along with
> our
> > larger application inside of an EAR file.  This ear file is then deployed
> > across multiple application servers.  However we only wanted consumers to
> be
> > active on certain dedicated servers.  I wasn't able to find a solution
> > within ActiveMQ that allows us to globally turn off consumers at
> deployment.
> >  For a while we were tweaking the consumers via JMX but that was
> problematic
> > and could only be done after the consumer was activated and started
> > processing.
> > I built our own activemq-rar-5.4.2.rar with the following modifications:
> > In ActiveMQResourceAdapter.java, public void
> > endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec
> > activationSpec)
> > Before creating the worker and checking to see if it previously activated
> a
> > quick system property check:
> >
> > if (!Boolean.valueOf(System.getProperty("activemq.endpoints.disabled",
> > "false"))) {...
> >
> > If true, dont' actually enable any queues etc.  I'm not sure this is the
> > best method but it seems to be working.  I've included a patch for the
> 5.4.2
> > branch.  I can prepare one for the trunk if the developers think this
> would
> > be a worthwhile contribution.
> > Jeremy
> > --
> > Jeremy Levy
> >
>
>
>
> --
> http://fusesource.com
> http://blog.garytully.com
>



-- 
Jeremy Levy

Re: Patch to disable all Queues

Posted by Gary Tully <ga...@gmail.com>.
interesting, I guess the "exclusive consumer" feature won't cut it as
you are limited to a single consumer.

How do those consumers eventually get activated, is a restart of the
container without the property?

Would it make sense to have the property settable via jmx, so an mbean
on the resource adapter?

On 1 June 2011 14:51, Jeremy Levy <je...@gmail.com> wrote:
> We currently deploy our ActiveMQ enabled Message Driven Beans along with our
> larger application inside of an EAR file.  This ear file is then deployed
> across multiple application servers.  However we only wanted consumers to be
> active on certain dedicated servers.  I wasn't able to find a solution
> within ActiveMQ that allows us to globally turn off consumers at deployment.
>  For a while we were tweaking the consumers via JMX but that was problematic
> and could only be done after the consumer was activated and started
> processing.
> I built our own activemq-rar-5.4.2.rar with the following modifications:
> In ActiveMQResourceAdapter.java, public void
> endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec
> activationSpec)
> Before creating the worker and checking to see if it previously activated a
> quick system property check:
>
> if (!Boolean.valueOf(System.getProperty("activemq.endpoints.disabled",
> "false"))) {...
>
> If true, dont' actually enable any queues etc.  I'm not sure this is the
> best method but it seems to be working.  I've included a patch for the 5.4.2
> branch.  I can prepare one for the trunk if the developers think this would
> be a worthwhile contribution.
> Jeremy
> --
> Jeremy Levy
>



-- 
http://fusesource.com
http://blog.garytully.com

Re: Patch to disable all Queues

Posted by Jeremy Levy <je...@gmail.com>.
Slightly updated patch, had a typo.

On Wed, Jun 1, 2011 at 9:51 AM, Jeremy Levy <je...@gmail.com> wrote:

> We currently deploy our ActiveMQ enabled Message Driven Beans along with
> our larger application inside of an EAR file.  This ear file is then
> deployed across multiple application servers.  However we only wanted
> consumers to be active on certain dedicated servers.  I wasn't able to find
> a solution within ActiveMQ that allows us to globally turn off consumers at
> deployment.  For a while we were tweaking the consumers via JMX but that was
> problematic and could only be done after the consumer was activated and
> started processing.
>
> I built our own activemq-rar-5.4.2.rar with the following modifications:
>
> In ActiveMQResourceAdapter.java, public void
> endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec
> activationSpec)
>
> Before creating the worker and checking to see if it previously activated a
> quick system property check:
>
> if (!Boolean.valueOf(System.getProperty("activemq.endpoints.disabled",
> "false"))) {...
>
>
> If true, dont' actually enable any queues etc.  I'm not sure this is the
> best method but it seems to be working.  I've included a patch for the 5.4.2
> branch.  I can prepare one for the trunk if the developers think this would
> be a worthwhile contribution.
>
> Jeremy
>
> --
> Jeremy Levy
>



-- 
Jeremy Levy