I am having a lot of difficulty getting limited retries and dead letter queues 
to work in ActiveMQ. I am developing using the activemq-cpp library in linux.

Versions:
* ActiveMQ 5.15.9
* Activemq-cpp 3.9.4

This is what I want to do:
*set DLQ and retry policies on the broker (xml below, schedulerSupport enabled)
*register a cms::MessageListener against a queue using Auto-acknowledge
*Have the message get redelivered during segfault according to below policy.

I would really prefer not to have to:
* use transactional messaging (commit/rollback.. the other ack modes might be 
acceptable)
* handle the retry logic at client side (due to segfault possibility)

What I am observing:
*When the cpp exe crashes with segfault, the message is returned to queue 
without delay and is never routed to DLQ no matter how *many redeliveries. This 
means the server goes into an infinite crash loop with the poisoned message.
*If the handleMessage call completes, the message disappears as expected.

Thanks

---------------------------------------------------------
(broker tag has schedulersupport="true")


  <destinationPolicy>
        <policyMap>
            <policyEntries>
                <policyEntry topic=">">
                    <subscriptionRecoveryPolicy>
                        <fixedCountSubscriptionRecoveryPolicy maximumSize="100" 
/>
                    </subscriptionRecoveryPolicy>
                    <!-- The constantPendingMessageLimitStrategy is used to 
prevent
                         slow topic consumers to block producers and affect 
other consumers
                         by limiting the number of messages that are retained
                         For more information, see:

                         http://activemq.apache.org/slow-consumer-handling.html
                        -->
                    <pendingMessageLimitStrategy>
                        <constantPendingMessageLimitStrategy limit="1000" />
                    </pendingMessageLimitStrategy>
                </policyEntry>
                <policyEntry queue=">_REQ">
                    <deadLetterStrategy>
                        <!--
                          Use the prefix 'DLQ.' for the destination name, and 
make
                          the DLQ a queue rather than a topic. expire after 7 
days
                          (604,800,000 ms)
                        -->
                        <individualDeadLetterStrategy queuePrefix="DLQ." 
useQueueForQueueMessages="true" expiration="604800000" 
processNonPersistent="true" />
                    </deadLetterStrategy>
                </policyEntry>
            </policyEntries>
        </policyMap>
    </destinationPolicy>

...

    <plugins>
        <redeliveryPlugin fallbackToDeadLetter="true"
                          sendToDlqIfMaxRetriesExceeded="true">
            <redeliveryPolicyMap>
                <redeliveryPolicyMap>
                    <!--
                    <redeliveryPolicyEntries>
                        <!-x- a destination specific policy -x->
                        <redeliveryPolicy queue="SpecialQueue"
                                          maximumRedeliveries="4"
                                          redeliveryDelay="10000"/>
                    </redeliveryPolicyEntries>
                    -->
                    <defaultEntry>
                        <!-- the fallback policy for all other destinations -->
                        <redeliveryPolicy maximumRedeliveries="4"
                                          initialRedeliveryDelay="1000"
                                          redeliveryDelay="5000"/>
                    </defaultEntry>
                </redeliveryPolicyMap>
            </redeliveryPolicyMap>
        </redeliveryPlugin>
    </plugins>
Proprietary/confidential information belonging to CGI Federal Inc. or its 
affiliates may be contained in this message. If you are not a recipient 
indicated or intended in this message (or responsible for the delivery of this 
message to such person), or if you think for any reason that this message may 
have been addressed to you in error, you may not use or copy or deliver this 
message to anyone else. In such case, you should destroy this message and are 
asked to notify the sender by reply email.

Reply via email to