Usage of EnableDeadLetteringOnFilterEvaluationExceptions in ASB transport

I am using Terraform to provision my application resources in Azure, including an ASB namespace and the messaging topology for NServiceBus.

The NServiceBus ASB operational scripting utilities set EnableDeadLetteringOnFilterEvaluationExceptions=false, as shown here:

I am currently unable to set this property the same way using Terraform. While investigating, I discovered that the attribute that would control this was removed in version 2.0 of the Terraform azurerm provider:
https://www.terraform.io/docs/providers/azurerm/guides/2.0-upgrade-guide.html

The deprecated dead_lettering_on_filter_evaluation_exceptions field will be removed, since this is no longer used.

I am not sure why this attribute was removed from Terraform ā€“ I cannot find any reference in the Azure documentation that this setting is or will be deprecated. When I create a subscription with Terraform, this property defaults to EnableDeadLetteringOnFilterEvaluationExceptions=true.

Is there any adverse behavior we would expect to encounter with NServiceBus if this property is left as ā€œtrueā€ instead of ā€œfalseā€? It would seem that properly configured subscription filters in an NServiceBus topology would never be expected to throw an exception. Are there some edge-cases that I am overlooking?

Hi Mike,

The upgrade guide deprecation note is puzzling to me as well.

Iā€™ve looked into this and something here doesnā€™t seem to be right. Subscriptionā€™s EnableDeadLetteringOnFilterEvaluationExceptions is not deprecated. You can see it in the current and the future (preview) .NET clients. Moreover, the property deadLetteringOnFilterEvaluationExceptions is still part of the latest version of the ARM template for subscriptions. Itā€™s optional but not deprecated. And the default should never be set to true. On the contrary, it should be set to false.

Is there any adverse behavior we would expect to encounter with NServiceBus if this property is left as ā€œtrueā€ instead of ā€œfalseā€? It would seem that properly configured subscription filters in an NServiceBus topology would never be expected to throw an exception. Are there some edge-cases that I am overlooking?

The feature is intended for testing (lower environments) and verification, not for production. You donā€™t want to throw an exception on the publisherā€™s side in production if a filter for a specific message doesnā€™t exist for subscribers.

I would suggest opening a support case with Terraform to get more details. Iā€™ve also sent this question to the Azure Service Bus team to confirm my statements as well as to see if they could reach out to Terraform for clarification.

1 Like

Sean, thanks for the quick response and digging into this.

I will open an issue in the Terraform GitHub repository to investigate further.

It appears from my initial review of the source code that the Terraform provider is not setting this attribute one way or the other when a subscription resource is created.
https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/azurerm/internal/services/servicebus/resource_arm_servicebus_subscription.go#L154

If that is the case, it would seem that the default value of EnableDeadLetteringOnFilterEvaluationExceptions=true is coming from the Azure service itself.

Here is the issue I opened in the relevant Terraform GitHub repository:

Hi Mike,

Iā€™ve left a comment on the issue youā€™ve raised, suggesting to raise an issue with the ASB broker as well. The default value of true for EnableDeadLetteringOnFilterEvaluationExceptions that ARM is applying when the parameter is not specified feels off. Especially for production environments as it goes against SB team recommendations to use this feature for testing purposes only. A recommendation that should be documented here.

Hereā€™s the document about use of this specific property and why it is not recommended for production:

Service Bus has one feature, used specifically for development, which should never be used in production configurations : TopicDescription.EnableFilteringMessagesBeforePublishing .

When new rules or filters are added to the topic, you can use TopicDescription.EnableFilteringMessagesBeforePublishing to verify that the new filter expression is working as expected.

Disregard the comment.

Hi Sean,

Iā€™m confused about your last comment ā€“ arenā€™t these two different properties (one on a Topic, and one on a Subscription)?

If there is a relationship between these properties, I am not clear about what the relationship is.

Thanks,
Mike

Hi Mike,
Iā€™m sorry, got confused by those two. Please disregard that comment.

1 Like

I also received confirmation from our MS support team that this property is not deprecated:

I found out that the EnableDeadLetteringOnFilterEvaluationExceptions is not deprecated, so looks like Terraform needs to fix it.

Second, what this means is, lets say I have a filter that is
x < 1/y
The subscription will look for messages that have ā€˜xā€™ and ā€˜yā€™ in it and accept the message, but then, if it finds out that ā€˜yā€™ is zero, its going to throw an exception.
It will then put the message in the dead letter queue.

The missing Terraform property has now been added by completion of this issue:

1 Like