lizining1231 opened a new pull request, #3815:
URL: https://github.com/apache/dubbo-go/pull/3815

   ### Description
   
   Fix #3813 , Part of #3810 and the Classic Dubbo sub-issue. 
   
   Extend public plugin configuration to Classic Dubbo at two separate levels: 
a stream serializer encodes the message body, and a named remoting codec 
encodes the complete request/response frame. Plugins can be registered outside 
the framework and selected through normal client/server configuration while 
existing serializer and remoting override APIs remain available.
   
   ### Changes
   
   #### 1. Named remoting codecs and configuration
   
   - Add validated protocol/name factory registration for complete-frame codecs 
and expose selection through Dubbo protocol options and YAML.
   - Preserve legacy singleton codec overrides and use the built-in Dubbo 
framing when no custom codec is selected.
   - Bind transport resources to connection and listener leases so one 
connection's closure does not invalidate another active user.
   
   #### 2. Dubbo stream serialization
   
   - Select body serializers by validated header serialization IDs and enforce 
configured receive policies before body decoding.
   - Provide a Hessian2 adapter and give each stream encoder/decoder ownership 
of one complete body, including metadata, arguments, attachments and 
object-reference state.
   - Decode arguments against method signatures using original bytes where 
concrete decoding is required. Preserve `int32`, large `int64`, slices and 
structs, and reject invalid numeric conversions.
   - Preserve baseline wire behavior, legacy serializer APIs and explicit user 
choices when resolving Dubbo serialization defaults.
   
   #### 3. Lifecycle and shared endpoints
   
   - Close failed factory results and release partially initialized connection 
resources without affecting surviving connections.
   - Recreate shared bindings from the original local settings and keep 
independent resource generations isolated during teardown and retry.
   - Reject incompatible framing, receive sets and configured scopes when 
services attempt to share a listener.
   
   #### 4. Tests and documentation
   
   - Include baseline body fixtures, typed stream decoding, frame boundaries, 
response correlation, receive-policy and failure-cleanup tests.
   - Add three external-module scenarios for public stream/framing plugins, 
independent JSON streams and discovered-provider connection leases.
   - Document stream contracts, framing factories, shared-listener constraints 
and resource ownership in the Dubbo module README.
   
   ### Test
   
   This PR adds 23 root-module tests and 3 independent-module RPC scenarios. 
Every new top-level test is listed below; table-driven subtests remain under 
their parent functions.
   
   #### `remoting/codec_factory_test.go`
   
   | Test | Description |
   | --- | --- |
   | `TestCodecFactoryAndLegacyOverride` | Select named factories while 
retaining legacy codec overrides. |
   | `TestSharedListenerCodecOwnership` | Close a shared listener binding only 
through its owner. |
   | `TestClientCodecLeasesAndLocalRecreation` | Share client leases and 
reconstruct resources from local settings after final release. |
   | `TestClientCodecConcurrentRelease` | Close client codec resources once 
under concurrent lease release. |
   | `TestCodecGenerationInterleaveAndRetry` | Keep old and new remoting codec 
generations independent across retries. |
   | `TestCodecRemotingFactoryResults` | Validate remoting factory results and 
clean up failed constructions. |
   
   #### `remoting/getty/getty_client_test.go`
   
   | Test | Description |
   | --- | --- |
   | `TestClientCloseReleasesOnlyItsCodecLease` | Closing one Getty client must 
not invalidate another client sharing the codec. |
   | `TestCodecGettyRetryAndPublicationLeases` | Release leases after 
connection failure or closure before connection publication. |
   
   #### `protocol/dubbo/impl/stream_test.go`
   
   | Test | Description |
   | --- | --- |
   | `TestStreamBaselineFixtures` | Verify stream encoding and decoding against 
baseline body fixtures. |
   | `TestIndependentJSONStreamRequest` | Decode Dubbo request fields with an 
independent JSON stream serializer. |
   | `TestIndependentJSONStreamResponse` | Decode Dubbo responses with an 
independent JSON stream serializer. |
   | `TestJSONStreamArgumentSignature` | Decode concrete integer, collection 
and struct arguments; reject invalid numeric conversions. |
   | `TestCodecStreamFailureCleanup` | Close stream resources on encoding and 
decoding failures. |
   | `TestCodecStreamSignatureRouting` | Resolve concrete method argument 
targets while preserving dynamic invocation behavior. |
   
   #### `protocol/dubbo/serialization_test.go`
   
   | Test | Description |
   | --- | --- |
   | `TestConfiguredDubboIDAndFraming` | Use the configured serialization ID 
and framing implementation. |
   | `TestDubboInitializationAndReceivePolicy` | Validate initialization 
settings and restrict accepted inbound serialization IDs. |
   | `TestCodecEndpointConflictAndBindingIsolation` | Reject incompatible 
shared-listener settings and isolate independent bindings. |
   | `TestCodecRuntimeViewAndLegacyOverride` | Preserve bound runtime views and 
legacy serializer overrides. |
   | `TestCodecConfiguredFrameBoundariesAndCorrelation` | Handle partial or 
adjacent frames and preserve response correlation. |
   
   #### `serialization/hessian2/codec_test.go`
   
   | Test | Description |
   | --- | --- |
   | `TestStreamOwnershipAndRecovery` | Preserve stream byte ownership and 
recover after failed operations. |
   | `TestStreamReferenceScope` | Keep object reference state scoped to one 
complete message body. |
   | `TestCodecHessianAttachmentTargetsAndNull` | Decode attachment targets and 
null values through the Hessian stream adapter. |
   
   #### `client/options_test.go`
   
   | Test | Description |
   | --- | --- |
   | `TestCodecSerializationDefaultsFollowFinalProtocol` | Resolve 
serialization defaults from the final selected protocol without overriding 
explicit choices. |
   
   #### `tests/codec-plugin/dubbo_plugin_test.go`
   
   | Test | Description |
   | --- | --- |
   | `TestDubboPluginRPC` | Exercise custom Dubbo stream serialization and 
remoting framing over real RPC connections. |
   
   #### `tests/codec-plugin/review_test.go`
   
   | Test | Description |
   | --- | --- |
   | `TestPureJSONStreamSharedEndpoint` | Exercise an independent JSON stream 
serializer on a shared Dubbo endpoint. |
   | `TestDubboDiscoveredProviderCodecLeases` | Keep surviving Dubbo 
connections usable after sibling closure or provider initialization failure. |
   
   The existing external `TestBuiltinsAndCorruptPayload` matrix is extended 
with the default Dubbo case.
   
   ### Checklist
   - [x] I confirm the target branch is `develop`
   - [x] I have run `make fmt` to format my code
   - [x] I have run `make test` to run local tests
   - [x] I have added tests that prove my fix is effective or that my feature 
works
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to