You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by sp <sh...@duke.edu> on 2014/01/02 17:14:03 UTC

redelivery works only once

Hi folks,

I'm trying to get redelivery to work and so far I haven't had much success. 
I'm running 5.9.0 and I'm using an Oracle database for persistence and I
have the following configuration.

        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" producerFlowControl="false"
useCache="false">
                    
                  <pendingMessageLimitStrategy>
                    <constantPendingMessageLimitStrategy limit="1000"/>
                  </pendingMessageLimitStrategy>
                  <deadLetterStrategy>
                    <individualDeadLetterStrategy topicPrefix="DLQ."
useQueueForTopicMessages="false" />
                  </deadLetterStrategy>
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy>

.. and...

        <plugins>
          <simpleAuthenticationPlugin>
            <users>
                <authenticationUser username="system" password="xx"
groups="admins"/>
                <authenticationUser username="testUser1" password="xx"
groups="testUser1"/>
                <authenticationUser username="testUser2" password="xx"
groups="testUser2"/>
            </users>
          </simpleAuthenticationPlugin>
            
          
          <authorizationPlugin>
            <map>
              <authorizationMap>
                <authorizationEntries>
                  <authorizationEntry topic="TEST.>"
read="testUser1,testUser2,admins" write="testUser1,testUser2,admins"
admin="testUser1,testUser2,admins" />
                  <authorizationEntry topic="ActiveMQ.Advisory.>"
read="testUser1,testUser2,admins" write="testUser1,testUser2,admins"
admin="testUser1,testUser2,admins"/>
                  <authorizationEntry topic="DLQ.>"
read="testUser1,testUser2,admins" write="testUser1,testUser2,admins"
admin="testUser1,testUser2,admins"/>
                </authorizationEntries>
              </authorizationMap>
            </map>
          </authorizationPlugin>
          <redeliveryPlugin fallbackToDeadLetter="true"
sendToDlqIfMaxRetriesExceeded="true">
              <redeliveryPolicyMap>
                  <redeliveryPolicyMap>
                      <defaultEntry>
                        <redeliveryPolicy maximumRedeliveries="6"
initialRedeliveryDelay="10000" redeliveryDelay="10000" />
                      </defaultEntry>
                  </redeliveryPolicyMap>
              </redeliveryPolicyMap>
          </redeliveryPlugin>
        </plugins>

When connecting to consume messages, I'm setting jms.prefetchPolicy.all=0
and using the acknowledgement mode CLIENT_ACKNOWLEDGE.  Also, the subscriber
is a durable subscriber.  

So here's what I'm seeing.  I add 3 messages to a topic.  Then the consumer
does the following:

1.  Calls receive(timeout) to receive the first message.  Then calls
recover().
2.  Calls receive(timeout) to receive the second message.  Then calls
recover().
3.  Calls receive(timeout) to receive the third message.  Then calls
recover().

A few moments later, 3 new rows are added to the activemq_msgs table.  Then
the client repeats the above.

4.  Calls receive(timeout) to receive the first message.  Then calls
recover().
5.  Calls receive(timeout) to receive the second message.  Then calls
recover().
6.  Calls receive(timeout) to receive the third message.  Then calls
recover().

Once again, a few moments later, 3 new rows are added to the table.  At this
point, the activemq_acks table indicates that the last acked id is 6
(assuming the first message was 1).  And the activemq_msgs table has
messages 1 through 9.  Nothing has gone into DLQ at this point.  However,
calling receive(timeout) doesn't retrieve any of the messages anymore.  But
if I restart the broker, I can get the messages again but only once this
time before they get "stuck" again.

If you have any ideas on what I'm doing wrong, I'd appreciate the help.

Thanks!

-- Shilen



--
View this message in context: http://activemq.2283324.n4.nabble.com/redelivery-works-only-once-tp4675932.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.