Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent auto provisioning with Azure Service Bus subscription rule filters #1021

Open
BrianVallelunga opened this issue Aug 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@BrianVallelunga
Copy link

BrianVallelunga commented Aug 26, 2024

Wolverine treats SQL filters differently from Correlation filters when auto-provisioning.

I have a couple of subscriptions with filters configured in Azure. We're using Pulumi to keep our infrastructure in code and it works well and one of my subscriptions has a SQL filter rule applied to it. Another has a correlation filter rule applied.

I was noticing that after provisioning the environment my SQL filter was being removed, but my correlation filter was not. At first I thought this was a problem with Azure, but then realized Wolverine was deleting my SQL filter, but not my correlation filter.

In neither case was I specifying the filters in the Wolverine code and just assumed they were ignored:

let registerHandler (wolverineOptions: WolverineOptions) =
    wolverineOptions
        .ListenToAzureServiceBusSubscription("my-subscription")
        .FromTopic("my-topic")
        .InteropWith(CustomAzureServiceBusMapper<MyEventType>())
    |> ignore

Aside from the subscription name, both handlers had the same registration code. I've since added the subscription filter to my registration.

let registerHandler (wolverineOptions: WolverineOptions) =
    wolverineOptions
        .ListenToAzureServiceBusSubscription("my-subscription")
        .FromTopic("my-topic")
        .ConfigureSubscriptionRule(fun rule ->
            rule.Filter <- SqlRuleFilter("MyMessageType = 'X' OR MyMessageType = 'Y'"))
        .InteropWith(CustomAzureServiceBusMapper<MyEventType>())
    |> ignore

I'm not sure if Wolverine should ignore existing rule filters or wipe them out, but the behavior should at least be consistent between filter types.

@Xzelsius
Copy link
Contributor

Xzelsius commented Sep 3, 2024

@BrianVallelunga here is the code which adjust subscription rules:

internal async ValueTask SetupAsync(ServiceBusAdministrationClient client, ILogger logger)

Back when I implemented this my intention was that Wolverine is the Master of the subscription. That's the reason it wipes out all other rules besides the default one.
The filter can be adjusted, so if you want your rule (non-default name) to stay either adjust the default rule Wolverine knows about or Wolverine needs to adapt some things.
But Wolverine might not work correctly if there are foreign rules active which prevents messages that Wolverine expects to receive.

But in the end, @jeremydmiller needs to decide what behavior he wants. I can just offer my help regarding ASB.

@jeremydmiller jeremydmiller added the bug Something isn't working label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants