Have a peek at this unit test for some further explanation. https://github.com/apache/activemq/blob/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/broker/BrokerRedeliveryTest.java
I think it will answer all of the above On 4 Mar 2014 01:19, "Li Li" <fancye...@gmail.com> wrote: > there are some questions. > 1. how cant a consumer reject a message? throw a runtimeexception? > 2. which parameter control retry times before moving to dead letter queue? > 3. what's maximumRedeliveries mean in the following xml? > does it mean 4 times redelivery to a single consumer before move > to dead letter queue or at most redelivery to 4 consumers(if it's > rejected by all)? > If the former is correct, How can I control the max times the > message redelivery from dead letter queue to original queue? > 4. if the max redelevery times exceed 4, will this message retain in > dead letter queue or be deleted? > <broker xmlns="http://activemq.apache.org/schema/core" > schedulerSupport="true" > > .... > <plugins> > <redeliveryPlugin fallbackToDeadLetter="true" > sendToDlqIfMaxRetriesExceeded="true"> > <redeliveryPolicyMap> > <redeliveryPolicyMap> > <redeliveryPolicyEntries> > <!-- a destination specific policy --> > <redeliveryPolicy queue="SpecialQueue" > maximumRedeliveries="4" > redeliveryDelay="10000" /> > </redeliveryPolicyEntries> > <!-- the fallback policy for all other > destinations --> > <defaultEntry> > <redeliveryPolicy maximumRedeliveries="4" > initialRedeliveryDelay="5000" > redeliveryDelay="10000" /> > </defaultEntry> > </redeliveryPolicyMap> > </redeliveryPolicyMap> > </redeliveryPlugin> > </plugins> > > On Mon, Mar 3, 2014 at 7:59 PM, Gary Tully <gary.tu...@gmail.com> wrote: > > peek at the broker redelivery plugin - > > > http://activemq.apache.org/message-redelivery-and-dlq-handling.html#MessageRedeliveryandDLQHandling-BrokerRedelivery(v5.7) > > > > that is most of what you want, the only caveat is that the number of > > retries is not auto tuned to the number of consumers so you will just > > have to pick a large enough value. Messages that a consumer rejects > > get resent to the queue. > > > > > > On 3 March 2014 09:54, Li Li <fancye...@gmail.com> wrote: > >> thank you very much. is it possible for client to send a message back > >> to the front of the queue? I mean if consumer A can't process this > >> message, it create a new message(the new message's content is the same > >> as the old one) and put it to the front of the queue(so it can be > >> consumed soon). I know I can set message priority. But I don't know > >> whether it's performant. > >> > >> On Mon, Mar 3, 2014 at 5:47 PM, Rob Davies <rajdav...@gmail.com> wrote: > >>> Beanstalkd might be a better fit for your use case - it's job based - > and iirc allows the client to reject jobs > >>> > >>> > >>>> On 3 Mar 2014, at 09:41, Li Li <fancye...@gmail.com> wrote: > >>>> > >>>> thank you. I want to know now is that to achieve my goal(as I > >>>> described before), is it suitable to use activemq(or activemq+camel). > >>>> if it's very hard to implement with activemq(+camel), I will try other > >>>> solutions. or any other solutions are very welcomed. I could use any > >>>> related solution(e.g. rabbitmq or other message related system) > >>>> > >>>>> On Mon, Mar 3, 2014 at 5:14 PM, Noel OConnor <noel.ocon...@gmail.com> > wrote: > >>>>> Rather than trying to change activemq you could look at implementing > >>>>> something with activemq and camel to provide this custom dispatch and > >>>>> redelivery mechanism. > >>>>> > >>>>> But as artnaseef stated it wouldn't be a simple solution. > >>>>> > >>>>> > >>>>>> On Mon, Mar 3, 2014 at 6:41 PM, Li Li <fancye...@gmail.com> wrote: > >>>>>> > >>>>>> sorry to hear that. I need this feature very much. is it possible to > >>>>>> "extend" activemq to achive this? is it difficult to modify the > >>>>>> dispatch logic of activemq? > >>>>>> > >>>>>>> On Mon, Mar 3, 2014 at 1:56 PM, artnaseef <a...@artnaseef.com> > wrote: > >>>>>>> JMS does not provide such a method. You could use one queue per > consumer > >>>>>> and have a consumer send the message back to an input queueon > failure, but > >>>>>> it would get complex since a way of knowing which consumers > rejected the > >>>>>> message would need to be tracked with the message, as well as > knowing all > >>>>>> the consumers and their queues. > >>>>>>> > >>>>>>> > >>>>>>> Sent from my iPhone > >>>>>>> > >>>>>>>> On Mar 2, 2014, at 9:36 PM, "Li Li [via ActiveMQ]" < > >>>>>> ml-node+s2283324n4678441...@n4.nabble.com> wrote: > >>>>>>>> > >>>>>>>> hi all, > >>>>>>>> can a queue message consumer "refuse" a message after receive a > >>>>>> message? > >>>>>>>> because a client don't know the message in advance. > >>>>>>>> onMessage(Message msg){ > >>>>>>>> if(CannotProcess(msg)){ > >>>>>>>> //refuse this message > >>>>>>>> } > >>>>>>>> } > >>>>>>>> what I need is: if the message can't be processed by one client, > it > >>>>>>>> can be sent to another consumer. > >>>>>>>> if all consumer "refuse" this message, then this message will be > >>>>>>>> removed to dead letter queue or to the end of the queue. > >>>>>>>> > >>>>>>>> > >>>>>>>> If you reply to this email, your message will be added to the > >>>>>> discussion below: > >>>>>> > http://activemq.2283324.n4.nabble.com/can-a-client-refuse-a-message-tp4678441.html > >>>>>>>> To start a new topic under ActiveMQ - User, email > >>>>>> ml-node+s2283324n234180...@n4.nabble.com > >>>>>>>> To unsubscribe from ActiveMQ - User, click here. > >>>>>>>> NAML > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> -- > >>>>>>> View this message in context: > >>>>>> > http://activemq.2283324.n4.nabble.com/can-a-client-refuse-a-message-tp4678441p4678446.html > >>>>>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com. > >>>>>> > > > > > > > > -- > > http://redhat.com > > http://blog.garytully.com >