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

[BUG] Create a Service Bus Subscription with a default Rule #37856

Closed
3 tasks done
brunomace opened this issue Nov 29, 2023 · 2 comments · Fixed by #39823
Closed
3 tasks done

[BUG] Create a Service Bus Subscription with a default Rule #37856

brunomace opened this issue Nov 29, 2023 · 2 comments · Fixed by #39823
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Bus

Comments

@brunomace
Copy link

Describe the bug
When creating a new Subscription with a first Rule, the Rule isn't taken into account a the default Rule is created.
The method called is ServiceBusAdministrationClient. createSubscription(String topicName, String subscriptionName, String ruleName, CreateSubscriptionOptions subscriptionOptions, CreateRuleOptions ruleOptions).
It works if I create a new Subscription, then create the Rule, then delete the default Rule. But the Subscription can collect other messages (see this issue: #29885).
The HTTP payload seems correct, it contains all the rule informations. So the problem is maybe on the server side.

Exception or Stack Trace
No error or exception is raised.

To Reproduce
Execute the code snippet.

Code Snippet

ServiceBusAdministrationClient asbClient = getClientViaConnectionString();
String topicName = "distribution.commun";
String subscriptionName = "test-" + System.currentTimeMillis();
CreateSubscriptionOptions subOpts = new CreateSubscriptionOptions();
String defaultRuleName = "document-recu";
CorrelationRuleFilter ruleFilter = new CorrelationRuleFilter();
ruleFilter.setLabel("1.1.evenement.document.recu");
CreateRuleOptions defaultRuleOpts = new CreateRuleOptions() //
		.setFilter(ruleFilter) //
		.setAction(new EmptyRuleAction());
// Create the Subscription with a default Rule
asbClient.createSubscription(topicName, subscriptionName, defaultRuleName, subOpts, defaultRuleOpts);
// Check
Collection<RuleProperties> rules = asbClient.listRules(topicName, subscriptionName).stream().toList();
if (rules.size() != 1) {
	System.err.println("" + rules);
	System.exit(1);
}
RuleProperties rule = rules.iterator().next();
if (!rule.getName().equals(defaultRuleName)) {
	// Will fail here
	System.err.println("" + rule.getName());
	System.exit(1);
}

Expected behavior
The default Rule isn't created, the specified Rule is created.

Setup:

  • Library/Libraries: com.azure:azure-messaging-servicebus:7.14.6 (the latest version available)
  • Java version: 17

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-triage This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus labels Nov 29, 2023
@brunomace
Copy link
Author

Apparently there is no unit test for this method.

@anuchandy anuchandy self-assigned this Nov 29, 2023
@anuchandy
Copy link
Member

Root cause: The generated model used the name "RuleDescription" to serialize the rule instead of "DefaultRuleDescription". This requires some analysis in the code generator.

@alzimmermsft alzimmermsft added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed needs-team-triage This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 19, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Bus
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants