vasipallyn opened a new pull request, #5436:
URL: https://github.com/apache/eventmesh/pull/5436
Fixes #5205
### Motivation
The `RemoteSubscribeEventProcessor` in the original report was removed in
the 2.0 redesign, but the same class of problem exists in its replacement, the
legacy HTTP bridge. `EventMeshMessageHttpCodec#parseSubscribe` only read
`"topics"` as an array of plain strings. A subscribe body from a 1.x client —
`"topic"` holding a `SubscriptionItem` list (`{topic, mode, type}`), which 1.x
`SubscribeRequestBody#toMap()` serializes as a JSON string — was parsed into
**zero topics** and still acknowledged with `ok`, so the client silently
received nothing.
### Modifications
- `EventMeshMessageHttpCodec`: parse topics from `"topics"`, falling back to
`"topic"`, accepting plain names, `SubscriptionItem` objects, either form
JSON-encoded as a string, and a single topic. Blank and duplicate names are
dropped. Malformed JSON still raises `IllegalArgumentException`.
- `LegacyHttpBridge#subscribe`: reject a request that resolves to no topics
instead of acknowledging it.
- `UniHttpServer#legacySubscribe`: return HTTP 400 (not 500) for invalid
legacy subscribe requests.
- Tests: new `EventMeshMessageHttpCodecTest` (7 cases) and
`LegacyHttpBridgeTest#legacySubscribeWithoutTopicsIsRejected`.
### Testing
- `EventMeshMessageHttpCodecTest`: 7/7 pass against the patched codec; 5/7
fail against the previous codec (the 1.x formats yield `[]`), confirming the
tests reproduce the bug.
- I could not run the full Gradle build locally (dependency download blocked
in my environment), so the full `eventmesh-runtime` test suite, the new
`LegacyHttpBridgeTest` case and Checkstyle are left to CI. Imports and line
lengths follow `style/checkStyle.xml`.
### Documentation
- Does this pull request introduce a new feature? no
- Behavior change: a legacy subscribe with no resolvable topics now returns
400 instead of a misleading 200.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Sm8k2r6t7XWrKDuFF5fb7c
--
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]