You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by greenbean <Ke...@ngc.com> on 2006/04/27 00:26:44 UTC

Consumer Priority

Say we have two servers with two worker machines consuming from queues spread
across two sites.  We want local worker machines to consume from the local
server and fall back to the remote worker.  Will something like what is
shown below work to allow the consumer priority to function?

I tried this, and messages appear to be consumed in a round robin style,
ignoring the priorities.

	<bean id="requestQueuePrimary"
		class="org.apache.activemq.command.ActiveMQQueue"
		autowire="constructor">
		<constructor-arg>
			<value>requestQueue?consumer.priority=1</value>
		</constructor-arg>
	</bean>

	<bean id="requestQueueSecondary"
		class="org.apache.activemq.command.ActiveMQQueue"
		autowire="constructor">
		<constructor-arg>
			<value>requestQueue?consumer.priority=10</value>
		</constructor-arg>
	</bean>

	<bean id="beanActivationSpecPrimary"
		class="org.apache.activemq.ra.ActiveMQActivationSpec">
		<property name="activeMQDestination" ref="requestQueuePrimary" />
		<property name="destinationType" value="javax.jms.Queue" />
		<property name="maximumRedeliveries" value="3" />
		<property name="messageSelector" value="" />		
	</bean>

	<bean id="beanActivationSpecSecondary"
		class="org.apache.activemq.ra.ActiveMQActivationSpec">
		<property name="activeMQDestination" ref="requestQueueSecondary" />
		<property name="destinationType" value="javax.jms.Queue" />
		<property name="maximumRedeliveries" value="3" />
		<property name="messageSelector" value="" />		
	</bean>

	<bean id="beanConnectionPrimary" class="org.jencks.JCAConnector">
		<property name="jcaContainer" ref="jencksPrimary" />
		<property name="activationSpec" ref="beanActivationSpecPrimary" />
		<property name="ref" value="requestReceivingBean" />
	</bean>
	
	<bean id="beanConnectionSecondary" class="org.jencks.JCAConnector">
		<property name="jcaContainer" ref="jencksSecondary" />
		<property name="activationSpec" ref="beanActivationSpecSecondary" />
		<property name="ref" value="requestReceivingBean" />
	</bean>	

	<bean id="requestReceivingBean"
		class="requestReceiverBean">
	</bean>
--
View this message in context: http://www.nabble.com/Consumer-Priority-t1514590.html#a4111003
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Consumer Priority

Posted by greenbean <Ke...@ngc.com>.
I would like to be able to tweak a dispatch policy using consumer priorities. 
I took a look at the round robin dispatch policy.  I did not see any
influence from the consumer priorities there, but I could have missed it if
it is coming from somewhere else.  Would creating a weighted round robin
dispatch policy be the best way get this funcionality?  I could just sort
the subscriptions based on the consumer info priority.

	
--
View this message in context: http://www.nabble.com/Consumer+Priority-t1514590.html#a4513911
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Consumer Priority

Posted by James Strachan <ja...@gmail.com>.
AFAIK the consumer priority is automatically lowered for network
connectors; so local clients always have a higher priority than remote
brokers.

On 4/26/06, greenbean <Ke...@ngc.com> wrote:
>
> Say we have two servers with two worker machines consuming from queues spread
> across two sites.  We want local worker machines to consume from the local
> server and fall back to the remote worker.  Will something like what is
> shown below work to allow the consumer priority to function?
>
> I tried this, and messages appear to be consumed in a round robin style,
> ignoring the priorities.
>
>         <bean id="requestQueuePrimary"
>                 class="org.apache.activemq.command.ActiveMQQueue"
>                 autowire="constructor">
>                 <constructor-arg>
>                         <value>requestQueue?consumer.priority=1</value>
>                 </constructor-arg>
>         </bean>
>
>         <bean id="requestQueueSecondary"
>                 class="org.apache.activemq.command.ActiveMQQueue"
>                 autowire="constructor">
>                 <constructor-arg>
>                         <value>requestQueue?consumer.priority=10</value>
>                 </constructor-arg>
>         </bean>
>
>         <bean id="beanActivationSpecPrimary"
>                 class="org.apache.activemq.ra.ActiveMQActivationSpec">
>                 <property name="activeMQDestination" ref="requestQueuePrimary" />
>                 <property name="destinationType" value="javax.jms.Queue" />
>                 <property name="maximumRedeliveries" value="3" />
>                 <property name="messageSelector" value="" />
>         </bean>
>
>         <bean id="beanActivationSpecSecondary"
>                 class="org.apache.activemq.ra.ActiveMQActivationSpec">
>                 <property name="activeMQDestination" ref="requestQueueSecondary" />
>                 <property name="destinationType" value="javax.jms.Queue" />
>                 <property name="maximumRedeliveries" value="3" />
>                 <property name="messageSelector" value="" />
>         </bean>
>
>         <bean id="beanConnectionPrimary" class="org.jencks.JCAConnector">
>                 <property name="jcaContainer" ref="jencksPrimary" />
>                 <property name="activationSpec" ref="beanActivationSpecPrimary" />
>                 <property name="ref" value="requestReceivingBean" />
>         </bean>
>
>         <bean id="beanConnectionSecondary" class="org.jencks.JCAConnector">
>                 <property name="jcaContainer" ref="jencksSecondary" />
>                 <property name="activationSpec" ref="beanActivationSpecSecondary" />
>                 <property name="ref" value="requestReceivingBean" />
>         </bean>
>
>         <bean id="requestReceivingBean"
>                 class="requestReceiverBean">
>         </bean>
> --
> View this message in context: http://www.nabble.com/Consumer-Priority-t1514590.html#a4111003
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>


--

James
-------
http://radio.weblogs.com/0112098/