qqeasonchen opened a new pull request, #5319:
URL: https://github.com/apache/eventmesh/pull/5319
# Issue #5299 Sub-PR A: route UniHttpServer ingress through FrameAdaptor SPI
## Summary
The HTTP ingress path now converts structured CloudEvents JSON bytes to
`EventMeshFrame` at the boundary via the `FrameAdaptor` SPI
(`CloudEventsFrameAdaptor`). `UniIngressService` no longer needs to import
`io.cloudevents.CloudEvent` on the HTTP code path. The runtime primary
path is now Frame-in / Frame-out; the CloudEvent-typed ingress methods
(`publish` / `publishBatch` / `request` / `reply` / `publishLite` /
`pollLite`) are preserved unchanged for binary compatibility with the TCP
bridge and out-of-tree callers.
## New public methods on `UniIngressService`
| New method | Purpose |
|---|---|
| `publishBatchFrames(topic, List<EventMeshFrame>)` | Primary batch ingress;
HTTP path uses one `FrameAdaptor.toFrame` per array element, then this method |
| `publishLiteFrame(parent, lite, EventMeshFrame)` | Primary lite ingress;
HTTP `/events/lite/publish` |
| `pollLiteFrames(parent, lite, max, timeoutMs) → List<EventMeshFrame>` |
Primary lite poll; HTTP `/events/lite/poll` response body serialized back to
CloudEvents JSON by the egress adapter |
| `requestFrame(topic, EventMeshFrame, timeout) → EventMeshFrame` | Primary
request-reply (§17) |
| `replyFrame(correlationId, EventMeshFrame)` | Primary reply path |
The CloudEvent-typed overloads are kept for binary compatibility with the
TCP bridge and out-of-tree callers. They will be deprecated in sub-PR B
once the TCP path also migrates to the `MeshMessageFrameAdaptor`.
## UniHttpServer changes (8 ingress call sites)
| Endpoint | Before | After |
|---|---|---|
| `POST /events/publish` | `EventFormatProvider.deserialize(body)` |
`FrameAdaptors.get("cloudevents").toFrame(new ByteTransport(body))` |
| `POST /events/publishBatch` | same per element, then
`publishBatch(List<CE>)` | same per element, then
`publishBatchFrames(List<Frame>)` |
| `POST /events/lite/publish` | `EventFormatProvider.deserialize(body)` |
`FrameAdaptor.toFrame(...)` + `publishLiteFrame(...)` |
| `GET /events/lite/poll` | `EventFormatProvider.serialize(ce)` per event |
`FrameAdaptor.toCloudEventsJson(frame)` per event |
| `POST /request` (blocking req-reply) |
`EventFormatProvider.deserialize(body)` + `request(CE)` |
`FrameAdaptor.toFrame(...)` + `requestFrame(...)`; response body via
`FrameAdaptor.toCloudEventsJson(reply)` |
| `POST /events/reply` | `EventFormatProvider.deserialize(body)` +
`reply(CE)` | `FrameAdaptor.toFrame(...)` + `replyFrame(...)` |
| `GET /events/poll` (egress) |
`FrameAdaptors.toCloudEventsJson(be.getEvent())` | unchanged (already
FrameAdaptor) |
`UniHttpServer` no longer imports `io.cloudevents.*`. The 5 imports
`FrameAdaptor` / `ByteTransport` / `EventMeshFrame` are added.
## Security stub — temporary bridge (sub-PR B scope)
The `filterChain.check(stubEvent, ctx)` ACL check inside
`UniHttpServer.publish`
still consumes a `CloudEvent`. A `TODO(#5299 sub-PR B)` comment marks the
spot.
The next sub-PR will:
1. Add `FilterChain.check(EventMeshFrame, FilterContext)` overload
2. Make `UniHttpServer` pass the Frame directly to the filter chain
3. Update `CloudEventFilter` / `AclFilter` / `SignatureVerifierFilter` /
`TokenAuthFilter` to look up extensions from Frame attributes
Until then, the HTTP path does a one-shot `frame.toCloudEvent()` for the
ACL call only. This is a runtime hot-path minor cost (one allocation per
request) that the next sub-PR removes.
## Acceptance against #5299
- [x] Runtime code paths (UniHttpServer) reference only `EventMeshFrame`,
not a protocol-specific envelope type
- [x] Each non-primary protocol has an explicit ingress/egress adapter
(CE is already primary; MeshMessage and A2A follow in sub-PR C
and existing sub-PR D)
- [x] Ingress / egress goes through `FrameAdaptor` SPI — no direct
`EventFormatProvider` calls in `UniHttpServer`
- [ ] `core` SDK package has no Netty / gRPC / OpenMessaging — out of
scope (issue marks this as a follow-up)
- [ ] Documentation marks each protocol path as primary / beta / legacy —
done in sub-PR D
## Verification
- `./gradlew.bat :eventmesh-runtime:compileJava --offline` → BUILD
SUCCESSFUL,
0 errors, no new warnings (45 deprecation warnings all pre-existing)
- `./gradlew.bat :eventmesh-runtime:checkstyleMain
:eventmesh-runtime:checkstyleTest --offline`
→ BUILD SUCCESSFUL, 0 violations
- `./gradlew.bat :eventmesh-runtime:test --offline --tests
"*UniIngressServiceTest*"
--tests "*UniHttpServer*Test*" --tests "*SecurityWiringTest*"
--tests "*SseStreamTest*"` → BUILD SUCCESSFUL, 17 tests, 0 failures, 0
ignored
## Files changed
-
`eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/http/UniHttpServer.java`
(61 +/29 -)
-
`eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/ingress/UniIngressService.java`
(67 +/2 -)
## Follow-up
- Sub-PR B: Filter chain migration (CloudEventFilter / AclFilter /
SignatureVerifierFilter / TokenAuthFilter) to accept `EventMeshFrame`
- Sub-PR C: TCP path migration (`UniTcpServer` + `MeshMessagePackageRouter`)
to use `MeshMessageFrameAdaptor`
- Sub-PR D: Documentation — §13.10 acceptance matrix, primary/beta/legacy
protocol labels, sdk.core/sdk.streaming/sdk.a2a/sdk.legacy discussion
- Once #5299 merges, unblocks #5303 (Storage SPI capabilities + TCK)
--
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]