Skip to content

Add Endpoint.BrokerRole for CritterWatch endpoint display (#2601)#2603

Merged
jeremydmiller merged 2 commits intomainfrom
feature/2601-broker-role
Apr 27, 2026
Merged

Add Endpoint.BrokerRole for CritterWatch endpoint display (#2601)#2603
jeremydmiller merged 2 commits intomainfrom
feature/2601-broker-role

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

Closes #2601.

Adds a new virtual string BrokerRole { get; protected set; } on the base Endpoint class with default "endpoint". Each transport-specific subclass sets it in its own ctor; NatsEndpoint overrides because Core NATS vs JetStream is a runtime choice.

The companion DisplayName property described in the issue was deferred — see the audit below; EndpointName already covers most of that need.

BrokerRole values per endpoint

Endpoint BrokerRole
RabbitMqQueue queue
RabbitMqExchange, RabbitMqRouting exchange
RabbitMqTopicEndpoint topic
AzureServiceBusQueue queue
AzureServiceBusTopic topic
AzureServiceBusSubscription subscription
AmazonSqsQueue queue
AmazonSnsTopic topic
KafkaTopic topic
PulsarEndpoint topic
PubsubEndpoint pubsub (per @jeremydmiller)
MqttTopic topic
RedisStreamEndpoint stream
NatsEndpoint subject (Core NATS) / stream (JetStream) — runtime override
SqlServerQueue, PostgresqlQueue, TenantedPostgresqlQueue, SqliteQueue, OracleQueue, MySqlQueue queue
DatabaseControlEndpoint queue
ExternalMessageTable table
LocalQueue queue
SharedMemoryTopic topic
SharedMemorySubscription subscription
StubEndpoint stub
TcpEndpoint socket (per @jeremydmiller)
HttpEndpoint route (per @jeremydmiller)
GrpcEndpoint grpc (per @jeremydmiller)
SignalRTransport, SignalRClientEndpoint hub (per @jeremydmiller)

Endpoint base default is "endpoint" for any custom subclass that forgets to override.

Tests

  • CoreTests/Configuration/broker_role_tests.cs — base default + LocalQueue, StubEndpoint, TcpEndpoint, SharedMemoryTopic, SharedMemorySubscription.
  • A broker_role_tests.cs added to every transport / persistence test assembly with a one-line check per concrete endpoint type, so any future endpoint addition that forgets to set BrokerRole fails at test time.
  • NATS test specifically covers both subject and stream to exercise the runtime override.

All broker_role_tests pass across 19 test assemblies. Full CoreTests suite (1369/1369) passes — no regression.

EndpointName audit (per Q2 in the design discussion)

Endpoint's base ctor sets EndpointName = uri.ToString() and most subclasses override it to a friendly value. The following concrete subclasses currently fall back to the URI string and may want a friendlier EndpointName for CritterWatch (none are touched in this PR — flagged for follow-up decision):

Endpoint Falls back to Suggested
SharedMemoryTopic memory://topicName topicName
SharedMemorySubscription memory://topic/sub Name (subscription)
HttpEndpoint full HTTP URI route template (no obvious constructor source)
GrpcEndpoint grpc://host:port \"$host:$port\"
SignalRClientEndpoint signalr://host:port/hub hub path
PulsarEndpoint persistent://tenant/ns/topic TopicName
TenantedPostgresqlQueue postgresql://q/dbname \"$queue@$dbname\"
DatabaseControlEndpoint db-control://nodeId \"Control-{NodeId}\"
CosmosDbControlEndpoint cosmosdb-control://nodeId same
ExternalMessageTable external-db://schema.table TableName.QualifiedName (already friendly)
TcpEndpoint tcp://host:port (set explicitly to URI) \"$host:$port\"

Test plan

  • dotnet build wolverine.slnx — full solution clean, 0 errors.
  • dotnet test src/Testing/CoreTests --framework net9.0 — 1369/1369 pass.
  • broker_role_tests pass across 19 transport / persistence test assemblies (RabbitMQ, ASB, SQS, SNS, Kafka, Pulsar, NATS, Pub/Sub, MQTT, Redis, SignalR, SqlServer, Postgresql, Sqlite, Oracle, MySql, Wolverine.Http, Wolverine.Grpc, CoreTests).

🤖 Generated with Claude Code

jeremydmiller and others added 2 commits April 27, 2026 11:40
Closes #2601.

Adds a new virtual `string BrokerRole { get; protected set; }` on the base
`Endpoint` class with default value `"endpoint"`. Each transport-specific
subclass sets the value in its constructor:

| Endpoint | BrokerRole |
|---|---|
| RabbitMqQueue | queue |
| RabbitMqExchange / RabbitMqRouting | exchange |
| RabbitMqTopicEndpoint | topic |
| AzureServiceBusQueue | queue |
| AzureServiceBusTopic | topic |
| AzureServiceBusSubscription | subscription |
| AmazonSqsQueue | queue |
| AmazonSnsTopic | topic |
| KafkaTopic | topic |
| PulsarEndpoint | topic |
| PubsubEndpoint | pubsub |
| MqttTopic | topic |
| RedisStreamEndpoint | stream |
| NatsEndpoint | subject (Core) / stream (JetStream) — runtime |
| SqlServer/Postgresql/Sqlite/Oracle/MySql/TenantedPostgresql Queue | queue |
| DatabaseControlEndpoint | queue |
| ExternalMessageTable | table |
| LocalQueue | queue |
| SharedMemoryTopic | topic |
| SharedMemorySubscription | subscription |
| StubEndpoint | stub |
| TcpEndpoint | socket |
| HttpEndpoint | route |
| GrpcEndpoint | grpc |
| SignalR{Transport,ClientEndpoint} | hub |

`NatsEndpoint` overrides the property entirely because the choice between
"subject" (Core NATS) and "stream" (JetStream) depends on the
`UseJetStream` flag and can change after construction.

Per-transport regression tests (`broker_role_tests.cs`) added in every
transport / persistence test assembly so future endpoint additions catch
a missing override at test time.

Note: the `DisplayName` property from the issue was deferred. `EndpointName`
already serves that purpose for most transports — see PR description for an
audit of which subclasses still fall back to `Uri.ToString()`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both the existing Endpoint.Role (System / Application enum) and the new
Endpoint.BrokerRole string are now first-class init-only properties on
EndpointDescriptor. CritterWatch reads EndpointDescriptor; surfacing
these directly means the UI doesn't have to crack the underlying URI to
filter system-owned endpoints or render the broker object kind.

Two new CoreTests cover the lift:

- endpoint_descriptor_lifts_broker_role_and_endpoint_role
- endpoint_descriptor_endpoint_role_reflects_system_endpoints

CoreTests: 1371/1371 pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

New Endpoint DisplayName and EndpointRole

1 participant