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

Correlation filter does not allow any messages through #794

Open
ArchiFloyd opened this issue Jul 9, 2024 · 4 comments
Open

Correlation filter does not allow any messages through #794

ArchiFloyd opened this issue Jul 9, 2024 · 4 comments

Comments

@ArchiFloyd
Copy link

ArchiFloyd commented Jul 9, 2024

Hi!

First and foremost, thank you for the awesome work on service bus explorer. It's a really helpful tool.

I experience that when trying to create a correlation filter marked as the default filter using service bus explorer, no messages are allowed through the filter. If I create the same correlation filter on a subscription through some quick and dirty C# code it allows messages.

The correlation filter I'm trying to create looks like this:
image

I've observed the issue in the following versions:
5.0.18
6.0.2

I'm not sure what more to include here.

@SeanFeldman
Copy link
Collaborator

@ArchiFloyd are these the stesps to repro?

  1. Create a subscription with a correlation filter (Property1 == 47381)
  2. Publish messages to the topic with the Property1 set to 47381
  3. Inspect the subscription for the messages

If I create the same correlation filter on a subscription through some quick and dirty C# code it allows messages.

Just to be on the same page, could you share the custom C# code used?

@ArchiFloyd
Copy link
Author

ArchiFloyd commented Jul 9, 2024

Thank you for the quick reply.
I couldn't find a way to directly create a subscription with a correlation filter immediately. So steps are:

  1. Create a new Subscription
  2. Delete the default rule
  3. Create new rule having the correlation filter with Property1 = 47381
  4. Inspect the subscription for messages.

My hack-ish C#:

var filter = new CorrelationRuleFilter { ApplicationProperties = { ["Property1"] = 47381 } };
var ruleOptions = new CreateRuleOptions { Filter = filter };
var topic = "testtopic"
var subscription = "testsub"

var doesTopicExist = await serviceBusAdministrationClient.TopicExistsAsync(
    topic,
    cancellationToken);

if (doesTopicExist.HasValue
    && doesTopicExist.Value)
{
    var doesSubscriptionExist = await serviceBusAdministrationClient.SubscriptionExistsAsync(
        topic,
        subscription,
        cancellationToken);

    if (doesSubscriptionExist.HasValue
        && !doesSubscriptionExist.Value)
    {
        await serviceBusAdministrationClient.CreateSubscriptionAsync(
            new CreateSubscriptionOptions(
                topic,
                subscription)
            {
                RequiresSession = true
            },
            ruleOptions ?? new CreateRuleOptions(),
            cancellationToken);
    }
}

@SeanFeldman
Copy link
Collaborator

I suspect the filter is working with a string value rather than numeric.
Send the property value as a string "47381" and you'll see it working.
This could be a bug with SBE that doesn't know how to work with numeric value.

@ArchiFloyd
Copy link
Author

ArchiFloyd commented Jul 9, 2024

In my case I'm not in control of the producer of the messages, thus, cannot change how it behaves.
My consumer is working with the subscription and filter created in C# which is fine to me. Let me know if you need anything from me. I can try to reproduce your findings if need be @SeanFeldman.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants