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:

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.

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