Closed mcijsouw closed 4 years ago
@ramya-rao-a Is this for data plane SDK?
@qiaozha Yes, this is for the azure-sb
package.
@mcijsouw We are working on a new library for Service Bus, where you should be able to use the correlation filter with user defined properties on the message. The azure-sb
package will soon be deprecated in favor of the new library and will not be getting any new features.
Please give the new library a try.
You can install it using npm install @azure/service-bus@next
.
The latest preview version at this moment is 7.0.0-preview.8
We will be publishing the stable version for this in this month.
And here is the sample that shows how you would use the ServiceBusAdministrationClient in the new package to create queues/topics/subscription. You can use the same client to create rules as well
In my project I'm creating a Service Bus topic subscription programmatically:
Then I would like to add a rule to filter all messages by a specific
TenantId
.The documentation on https://docs.microsoft.com/en-us/azure/service-bus-messaging/topic-filters states that you can match against any user-defined property with a CorrelationFilter. However, the library does not support this. Looking at https://github.com/Azure/azure-sdk-for-node/blob/master/lib/services/serviceBus/lib/models/ruleresult.js the only options are:
The last option
correlationIdFilter
is not suitable for my needs since it filters onCorrelationId
.I would like to add a
correlationFilter
where I can specify both the key and the value. Can you add this to the library? Something like this:Possible (not desired) workaround:
As a workaround I could use
{ sqlExpression: "TenantId = 'my-tenant-id'" }
, but the documentation states the following: "Whenever possible, applications should choose correlation filters over SQL-like filters because they're much more efficient in processing and have less impact on throughput."