activemq-artemiskubernetes-operatorartemiscloud

How to remove the default DLQ of Artemis in a Kubernetes Operator deployment to avoid duplicated messages in DLQs


I have configured a Kubernetes operator based Artemis deployment to

  1. Use individual DLQs per queue with the prefix "DLQ."
  2. Auto create deadLetter resources

That works fine. If a message exceeds the max delivery attempts, it is moved to the DLQ of its queue.

However, in Artemis there is a DLQ default address that contains a DLQ default queue. All automatically created, specific DLQs are added to this DLQ address. So it contains the default queue named DLQ and any number of specific DLQs named DLQ.[queuename].

The specific DLQs are automatically created with a filter that includes only messages with the specific queue as origin, for example _AMQ_ORIG_ADDRESS = 'testqueue'. So far so good.

But the problem I encounter is, that failed messages from testqueue are not only moved to DLQ.testqueue, but are also copied to DLQ. The same message is in 2 different DLQs. This is reasonable because the message is sent to every queue of the address that does not exclude it and since the default DLQ has non filter, it takes all messages.

First I thought that this is just 1 message visible in 2 queues, but no matter if I delete the message in DLQ or DLQ.testqueue, it is not deleted from the other. Those are really 2 messages.

Now I think that I would have to remove the default DLQ of Artemis that is configured in broker.xml.

But how can I do this? The operator merges a default configuration with my configuration and I don't see an obvious way to "overwrite" the default address definitions with nothing.

I can add CRs of type ActiveMQArtemisAddress to create addresses and queues, but I don't see how to remove the default addresses.

Thanks for any help.


Solution

  • The default addresses and queues can be removed from the configuration by using the broker properties in the ActiveMQArtemis CR, i.e.

    apiVersion: broker.amq.io/v1beta1
    kind: ActiveMQArtemis
    metadata:
      name: artemis-remove-dlq
    spec:
      brokerProperties:
        - "addressConfigurations.DLQ.queueConfigs.DLQ=-"
    

    When the persistence is enabled or when the broker is already running, the queue must also be deleted from the journal bindings, by using the artemis CLI or the management API, i.e.

    kubectl exec artemis-remove-dlq-ss-0 -- /home/jboss/amq-broker/bin/artemis queue delete --name DLQ