lizining1231 opened a new issue, #3813:
URL: https://github.com/apache/dubbo-go/issues/3813
### Summary
Sub-issue of #3810
Allow applications to select external Classic Dubbo body serializers and
complete-frame codecs through normal configuration, using the shared extension
contracts introduced by #3810.
The parent issue covers the shared extension mechanism, configuration and
Triple integration. This sub-issue covers Classic Dubbo; a separate sub-issue
covers the independent gRPC protocol.
### Problem
Classic Dubbo has two distinct encoding responsibilities: serializing the
message body and encoding the complete request/response frame. Existing
serializer and remoting hooks do not provide the same factory-based
registration, scoped configuration and ownership guarantees as the proposed
public extension mechanism. A plugin should be selectable through normal
application configuration without requiring changes to the protocol
implementation.
Body serialization also needs a stream contract: a Dubbo body contains
protocol metadata, arguments, attachments and potentially shared object
references. Concatenating independently serialized values is insufficient.
Plugins must also decode values into the concrete types declared by the
service, without losing integer precision or depending on Hessian-specific
dynamic value types.
### Proposed Design
#### 1. Integrate body serialization
- Use the serialization contracts and configuration introduced by the parent
issue.
- Register Dubbo body serializers by name and a valid 5-bit serialization
ID; validate reserved IDs and reject duplicate assignments.
- Provide a Hessian2 stream adapter that preserves existing request/response
behavior.
- Give each encoder or decoder one complete message body, including
reference state and attachments.
- Decode business arguments against method signatures using the original
encoded bytes when concrete decoding is required. Preserve wide integers,
slices and structs, and reject fractional or overflowing numeric values.
- Apply the configured receive policy before decoding a body. Unknown or
disabled IDs must fail rather than select another serializer.
#### 2. Expose complete-frame codecs
- Add named remoting codec factories, selected through Dubbo protocol
options and YAML configuration.
- Keep body serialization and complete-frame encoding as separate extension
points.
- Preserve existing serializer and remoting singleton override APIs.
```mermaid
flowchart TD
A[Application configuration] --> B{Extension selection}
B --> C[Body serialization plugin]
C --> D[Metadata, arguments and attachments]
D --> E[Complete Dubbo body]
B --> F[Named remoting codec]
E --> F
F --> G[Dubbo request or response frame]
G --> H[Getty connection]
```
#### 3. Define ownership and compatibility
- Lease shared codec bindings to connections and listeners. Closing one
connection must not invalidate a surviving connection.
- Release partially created resources on initialization failure and close
shared instances after their final owner releases them.
- Reject incompatible framing, receive policies or configured scopes on a
shared endpoint.
- Treat absent configuration and empty configuration snapshots as the same
unconfigured scope, so internal metadata services and business services can
continue sharing a default Dubbo endpoint.
- Recreate bindings from the original local configuration rather than
remotely advertised discovery parameters.
### Scope and Compatibility
This sub-issue includes Classic Dubbo stream serialization, named remoting
codecs, protocol configuration, connection/listener ownership, compatibility
handling, regression tests and documentation. Preserve existing Hessian2 wire
behavior, default framing and legacy registration APIs.
It depends on the shared mechanism and configuration in #3810, and can
proceed independently of the gRPC sub-issue after the shared/Triple PR is
merged. A concrete Fory plugin, new interoperable serialization ID assignments,
Java interoperability certification and performance optimization are outside
this sub-issue.
### Acceptance Criteria
1. A plugin in a separate Go module can register a stream serializer and
complete-frame codec and complete RPC through public client/server APIs.
2. Baseline Hessian2 wire fixtures and legacy override behavior remain
compatible.
3. Typed argument, malformed payload, receive-policy, frame-boundary and
response-correlation tests pass.
4. Shared connections remain usable after sibling closure or failed
connection initialization; cleanup tests cover failure paths and final release.
5. Compatible services, including the internal metadata service and a
business service, can share the default Dubbo endpoint; genuinely incompatible
configurations are rejected.
6. The multi-protocol OTLP tracing sample passes with the integration
applied.
7. The PR includes its own implementation, regression tests and protocol
documentation.
--
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]