Skip to content

feat: Add topic SqlFilterCount and CorrelationFilterCount runtime properties - #50022

Open
EldertGrootenboer wants to merge 3 commits into
mainfrom
feature/servicebus-topic-filter-counts-37720586
Open

feat: Add topic SqlFilterCount and CorrelationFilterCount runtime properties#50022
EldertGrootenboer wants to merge 3 commits into
mainfrom
feature/servicebus-topic-filter-counts-37720586

Conversation

@EldertGrootenboer

Copy link
Copy Markdown
Member

Description

Adds the topic-level SqlFilterCount and CorrelationFilterCount runtime properties to the Service Bus administration client, porting the merged .NET implementation (Azure/azure-sdk-for-net#61559) to Java.

API additions

  • TopicRuntimeProperties.getSqlFilterCount() and getCorrelationFilterCount() — the total number of SQL / correlation filters across all of a topic's subscriptions, populated by getTopicRuntimeProperties / getTopicsRuntimeProperties.
  • ServiceBusServiceVersion.V2024_05, now the latest. The administration client sends api-version=2024-05 by default, which the service requires to serve the filter counts. Existing operations are unaffected, and callers can still pin an earlier version.

Behavior

  • The counts are served by the 2024-05 service API version and by regions that have deployed the feature. When absent (older api-version or region), they default to 0.

Code generation

  • The two properties are injected into the generated TopicDescription via a swagger directive, because the pinned 2021-05 input swagger does not yet define them. A regeneration therefore reproduces the fields (verified by running autorest locally — the regenerated TopicDescription matches the committed file). The directive is to be removed once the input-file is bumped to a spec revision that defines the properties.

Tests

  • Unit: service-version default + api-version string mapping; runtime-property propagation + default-to-zero-when-absent; XML serialize/deserialize round-trip.
  • Live: creates a topic with a SQL rule and a correlation rule and asserts SqlFilterCount == 2 (the $Default TrueFilter + the explicit SQL rule) and CorrelationFilterCount == 1. Validated against a live namespace.

Checklist

  • CHANGELOG entry added
  • Unit tests pass
  • Live-validated

…perties

- Add getSqlFilterCount() and getCorrelationFilterCount() to TopicRuntimeProperties,
  exposing the total number of SQL and correlation filters across all of a topic's
  subscriptions
- Add ServiceBusServiceVersion.V2024_05 and make it the latest; the administration
  client now sends api-version=2024-05 by default, which the topic filter counts require
- Parse SqlFilterCount/CorrelationFilterCount ATOM elements onto TopicDescription and
  default to 0 when absent (older region or api-version)
- Add a swagger codegen directive so a regeneration reproduces the two fields instead of
  dropping them
- Add unit tests (service-version default and mapping, propagate and default-to-zero, XML
  round-trip) and a live integration test asserting the counts
…pic-filter-counts-37720586

# Conflicts:
#	sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the Azure Service Bus administration client to surface topic-level runtime counts for SQL and correlation filters, and updates the default administration api-version to 2024-05 to enable the service to return these new fields.

Changes:

  • Added sqlFilterCount and correlationFilterCount plumbing from generated TopicDescriptionTopicProperties → public TopicRuntimeProperties.
  • Introduced ServiceBusServiceVersion.V2024_05 and made it the default/latest service version.
  • Added unit and live integration coverage for version mapping, runtime-property propagation/defaulting, and XML serialization/deserialization.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sdk/servicebus/azure-messaging-servicebus/swagger/README.md Injects SqlFilterCount / CorrelationFilterCount into TopicDescription via an AutoRest directive for the pinned swagger.
sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusServiceVersionTest.java Verifies latest version selection and enum → api-version string mapping.
sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusManagementSerializerTest.java Adds XML round-trip test coverage for the new topic filter-count elements.
sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/TopicRuntimePropertiesTest.java Validates propagation to public TopicRuntimeProperties and default-to-zero behavior when absent.
sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationClientIntegrationTest.java Adds a live-only test that creates rules and validates the returned topic-level filter counts.
sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusServiceVersion.java Adds V2024_05 and updates getLatest() to return it.
sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/models/TopicRuntimeProperties.java Adds public getters for SQL/correlation filter counts.
sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/models/TopicProperties.java Captures filter counts from TopicDescription and exposes internal getters for runtime model construction.
sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/implementation/models/TopicDescription.java Adds generated fields, XML (de)serialization, and accessors for the new counts.
sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md Documents the new runtime properties and service-version default change.

Comment thread sdk/servicebus/azure-messaging-servicebus/swagger/README.md

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Suppressed comments (1)

sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationClientIntegrationTest.java:552

  • This integration test is currently gated to TestMode.LIVE only, so it will be skipped in both RECORD (when recordings are created) and PLAYBACK (the default CI mode for proxy-based tests). That makes the test effectively non-executing in normal runs and increases the risk that it silently breaks over time.

Consider allowing RECORD as well (recordings can be captured from a feature-enabled namespace), and optionally later enabling PLAYBACK once a stable recording exists.

        assumeTrue(super.getTestMode() == TestMode.LIVE, "Filter counts require a live feature-enabled namespace.");

The default administration api-version is now 2024-05 (getLatest()), which the
recorded playback tests would send, but their session recordings were captured
at 2021-05, so the test proxy could not match the requests.

- Pin the recorded (playback/record) modes to ServiceBusServiceVersion.V2021_05
  in the shared configure() and the impl-client and unauthorized-client builders;
  live mode keeps the latest default.
- Mark getTopicFilterCounts with @liveonly so it skips cleanly in playback (it
  needs the 2024-05 default and a feature-enabled live namespace, and has no
  recording), instead of failing setup on a missing recording.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

@EldertGrootenboer
EldertGrootenboer marked this pull request as ready for review August 3, 2026 22:28
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
34 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@EldertGrootenboer
EldertGrootenboer enabled auto-merge (squash) August 3, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants