azure-sdk-for-java
azure-sdk-for-java copied to clipboard
[BUG] Unable to Create a Service Bus Subscription with Rules
Describe the bug Using the Java SDK, we are not capable of creating a Service Bus Subscription on a topic with rules initially. If you are trying to create a new subscription that would filter on a subset of the data coming to the topic, this is currently not possible without a tiny chance of other data making it onto this subscription because you have follow the following steps:
- createSubscription()
- createRule(with filter)
- deleteRule(for default)
That leaves the potential for messages in a high volume topic to make it to the subscription that shouldn't be there.
Code Snippet
private fun buildSubscriptionWithRules(record: Record) {
val formattedName = Utils.formatName(record)
adminClient.createSubscription(configProperties.topic, formattedName, CreateSubscriptionOptions())
val rule = CreateRuleOptions(SqlRuleFilter("companyId = '${record.company}'"))
adminClient.createRule(configProperties.topic, "companyFilter", formattedName, rule)
adminClient.deleteRule(configProperties.topic, formattedName,"\$Default")
}
Expected behavior I would expect feature parity with the Azure SDK for .NET. https://github.com/Azure/azure-sdk-for-net/blob/5adaf18bf8e50514f6e10110cf74233a7ea56151/sdk/servicebus/Azure.Messaging.ServiceBus/src/Administration/ServiceBusAdministrationClient.cs#L1927 Notice that you can supply a CreateRuleOptions on creation. This would alleviate the issue.
Setup (please complete the following information):
- Java/Kotlin 11
- Spring Boot 2.6.7
- Azure SDK BOM - 1.1.0
- com.azure:azure-messaging-servicebus - version powered by BOM
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
- [X] Bug Description Added
Thanks for filing this github issue, @azizabah. @ki1729 can you please follow up?
/cc @Azure/azsdk-sb-java
@ki1729 can you please share an update?
@azizabah I am working on this feature, and I expect this to be released as part of the SDK release cycle next month
@joshfree @ki1729 - Any update on this?
@azizabah This change is now merged and should be released as part of version 7.13
@azizabah This change is now merged and should be released as part of version 7.13
@ki1729 - Can you please link the PR to this issue? Thanks.
Sure @azizabah. Here is the PR for the issue: https://github.com/Azure/azure-sdk-for-java/pull/31804
@azizabah New SDK v7.13 released today supports this capability. Let us know if you have any issues using it.
@ki1729 - Will do. Thanks!