Patterson
Patterson

Reputation: 2781

How to Enable duplicate message detection for an Azure Service Bus queue or a topic After Queue has been created

Can someone let me know if its possible to enable/update a Service Queue with Dupliate Message Detection after the Queue has been created?

The following link describes how to enable Duplicate Message Detection while creating a queue.

https://learn.microsoft.com/en-us/azure/service-bus-messaging/enable-duplicate-detection But I'm not seeing any information on how update an existing Queue to allow for Duplicate Message Detection ... or am I looking in the right place?

Upvotes: 3

Views: 2206

Answers (1)

rickvdbosch
rickvdbosch

Reputation: 15571

The article you linked to has a big purple Note block right after the first paragraph. It states two things. The second statement is:

You can't enable or disable duplicate detection after the queue or topic is created. You can only do so at the time of creating the queue or topic.

This means you cannot update an existing Queue to allow for Duplicate Message Detection.

EDIT:
A small addition to the above: there is an --enable-duplicate-detection parameter for the az servicebus queue update Azure CLI command. Trying to use this, however, returns a BadRequest with SubCode 40000 and a specific error message.

Looking at Service Bus Resource Manager exceptions - Error: Bad Request, it states the following:

Error message Description Recommendation
SubCode=40000. The value for the 'requiresDuplicateDetection' property of an existing Queue(or Topic) cannot be changed. The value for the 'requiresDuplicateDetection' property of an existing Queue(or Topic) cannot be changed. Duplicate detection must be enabled/disabled at the time of entity creation. The duplicate detection configuration parameter cannot be changed after creation.

EDIT:
According to the exceptions documentation linked to above (under Bad Request, second last item in the table), RequiresSessions also needs to be specified during creation:

Support for sessions should be enabled at the time of entity creation. Once created, you cannot enable/disable sessions on an existing entity (queue or subscription)

Upvotes: 1

Related Questions