DGS-23025 Add AssociatedNameStrategy#2577
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces an “Associated” subject name strategy that resolves the Schema Registry subject for a topic via Schema Registry associations, and wires the serdes to use an async subject naming delegate to support this lookup.
Changes:
- Added
SubjectNameStrategy.Associatedplus an async subject-name strategy delegate pipeline (serdes now await subject resolution). - Added Schema Registry REST + client APIs for association CRUD / lookup, and corresponding data contracts.
- Added unit tests and mock support to validate associated subject resolution, fallback behavior, and kafka-cluster-namespace behavior.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| test/Confluent.SchemaRegistry.Serdes.UnitTests/SerializeDeserialize.cs | Adds unit tests covering Associated strategy behavior and fallback. |
| test/Confluent.SchemaRegistry.Serdes.UnitTests/BaseSerializeDeserialize.cs | Extends mock Schema Registry client to support association lookups used by tests. |
| src/Confluent.SchemaRegistry/SubjectNameStrategy.cs | Adds async subject strategy delegate, Associated strategy implementation, and ToAsyncDelegate. |
| src/Confluent.SchemaRegistry/Rest/RestService.cs | Adds REST calls for association lookup/create/delete and a void-request helper. |
| src/Confluent.SchemaRegistry/Rest/IRestService.cs | Exposes association REST endpoints to the internal REST service interface. |
| src/Confluent.SchemaRegistry/Rest/DataContracts/Association.cs | New association DTO for REST responses. |
| src/Confluent.SchemaRegistry/Rest/DataContracts/AssociationInfo.cs | New association info DTO for create/update responses. |
| src/Confluent.SchemaRegistry/Rest/DataContracts/AssociationResponse.cs | New DTO for create/update association responses. |
| src/Confluent.SchemaRegistry/Rest/DataContracts/AssociationCreateOrUpdateRequest.cs | New DTO for create/update association requests. |
| src/Confluent.SchemaRegistry/Rest/DataContracts/AssociationCreateOrUpdateInfo.cs | New DTO for association create/update items. |
| src/Confluent.SchemaRegistry/ISchemaRegistryClient.cs | Adds association APIs to the public client interface. |
| src/Confluent.SchemaRegistry/CachedSchemaRegistryClient.cs | Implements the new association APIs via RestService. |
| src/Confluent.SchemaRegistry/AsyncSerde.cs | Switches serdes to use an async subject name delegate and await subject resolution. |
| src/Confluent.SchemaRegistry.Serdes.Protobuf/ProtobufSerializer.cs | Uses ToAsyncDelegate and allows strategy.* configs. |
| src/Confluent.SchemaRegistry.Serdes.Protobuf/ProtobufDeserializer.cs | Uses ToAsyncDelegate and allows strategy.* configs. |
| src/Confluent.SchemaRegistry.Serdes.Json/JsonSerializer.cs | Uses ToAsyncDelegate and allows strategy.* configs. |
| src/Confluent.SchemaRegistry.Serdes.Json/JsonDeserializer.cs | Uses ToAsyncDelegate and allows strategy.* configs. |
| src/Confluent.SchemaRegistry.Serdes.Avro/SpecificSerializerImpl.cs | Awaits async subject name resolution. |
| src/Confluent.SchemaRegistry.Serdes.Avro/SpecificDeserializerImpl.cs | Awaits async subject name resolution. |
| src/Confluent.SchemaRegistry.Serdes.Avro/GenericSerializerImpl.cs | Awaits async subject name resolution. |
| src/Confluent.SchemaRegistry.Serdes.Avro/GenericDeserializerImpl.cs | Awaits async subject name resolution. |
| src/Confluent.SchemaRegistry.Serdes.Avro/AvroSerializer.cs | Allows strategy.* configs (validation change). |
| src/Confluent.SchemaRegistry.Serdes.Avro/AvroDeserializer.cs | Allows strategy.* configs (validation change). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 23 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 23 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f9fab11 to
96f1d99
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 23 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/Confluent.SchemaRegistry.Serdes.Protobuf/ProtobufDeserializer.cs:148
- The code instantiates
new T()twice in this method: once at line 139 to get the Descriptor.FullName, and again at line 148 to create the actual message object. This is wasteful and could cause issues if the constructor has side effects or is expensive. Consider moving the secondGetSubjectNamecall to after line 148 and usingmessage.Descriptor.FullNameinstead of creating a new instance. This would reduce unnecessary object allocation and potential side effects.
if (subject == null)
{
subject = await GetSubjectName(topic, isKey, new T().Descriptor.FullName).ConfigureAwait(false);
}
}
payload = await ExecuteRules(context.Component == MessageComponentType.Key,
subject, context.Topic, context.Headers, RulePhase.Encoding, RuleMode.Read,
null, writerSchema, payload, null)
.ContinueWith(t => t.Result is byte[] bytes ? new ReadOnlyMemory<byte>(bytes) : (ReadOnlyMemory<byte>)t.Result)
.ConfigureAwait(continueOnCapturedContext: false);
message = new T();
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
1 similar comment
|


What
Checklist
References
JIRA:
Test & Review
Open questions / Follow-ups