eventmesh icon indicating copy to clipboard operation
eventmesh copied to clipboard

[Bug] In the SDK-Java HTTP subscription method, it is unable to subscribe to events from the HttpConnector Source.

Open linyf-B opened this issue 6 months ago • 5 comments

Search before asking

  • [x] I had searched in the issues and found no similar issues.

Environment

Linux

EventMesh version

master

What happened

tag v1.12.0:

In the SDK-Java HTTP subscription method, it is unable to subscribe to events from the HttpConnector Source.

How to reproduce

The source of the httpconnector in Eventmesh provides an HTTP interface to receive the data, and then writes it to Eventmesh. I used http in SDK-java to subscribe, but it got an error.

cloudevent to HttpEventWrapper occur except, group:CC, topic:table6a, bizSeqNo=c8cdbe62-5f7f-4484-b562-23ee1b28aa54, uniqueId=c8cdbe62-5f7f-4484-b562-23ee1b28aa54 java.lang.ClassCastException: org.apache.eventmesh.common.protocol.tcp.Package cannot be cast to org.apache.eventmesh.common.protocol.http.HttpEventWrapper at org.apache.eventmesh.runtime.core.protocol.http.push.AsyncHTTPPushRequest.tryHTTPRequest(AsyncHTTPPushRequest.java:169) ~[eventmesh-runtime-1.11.0-release.jar:1.11.0-release] at org.apache.eventmesh.runtime.core.protocol.http.push.HTTPMessageHandler.lambda$handle$2(HTTPMessageHandler.java:92) ~[eventmesh-runtime-1.11.0-release.jar:1.11.0-release] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_162] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_162] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_162] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_162] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_162] 2026-05-06 09:54:11,167 WARN [eventMesh-pushMsg-2] AsyncHTTPPushRequest(AsyncHTTPPushRequest.java:179) - cloudevent to HttpEventWrapper occur except, group:TT, topic:table6a, bizSeqNo=49df2557-ddef-4641-a06a-9901ea15e645, uniqueId=49df2557-ddef-4641-a06a-9901ea15e645 java.lang.ClassCastException: org.apache.eventmesh.common.protocol.tcp.Package cannot be cast to org.apache.eventmesh.common.protocol.http.HttpEventWrapper at org.apache.eventmesh.runtime.core.protocol.http.push.AsyncHTTPPushRequest.tryHTTPRequest(AsyncHTTPPushRequest.java:169) ~[eventmesh-runtime-1.11.0-release.jar:1.11.0-release] at org.apache.eventmesh.runtime.core.protocol.http.push.HTTPMessageHandler.lambda$handle$2(HTTPMessageHandler.java:92) ~[eventmesh-runtime-1.11.0-release.jar:1.11.0-release] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_162] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_162] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_162] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_162] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_162] 2026-05-06 09:54:11,167 WARN [eventMesh-pushMsg-2] AsyncHTTPPushRequest(AsyncHTTPPushRequest.java:179) - cloudevent to HttpEventWrapper occur except, group:CC, topic:table6a, bizSeqNo=49df2557-ddef-4641-a06a-9901ea15e645, uniqueId=49df2557-ddef-4641-a06a-9901ea15e645 java.lang.ClassCastException: org.apache.eventmesh.common.protocol.tcp.Package cannot be cast to org.apache.eventmesh.common.protocol.http.HttpEventWrapper at org.apache.eventmesh.runtime.core.protocol.http.push.AsyncHTTPPushRequest.tryHTTPRequest(AsyncHTTPPushRequest.java:169) ~[eventmesh-runtime-1.11.0-release.jar:1.11.0-release] at org.apache.eventmesh.runtime.core.protocol.http.push.HTTPMessageHandler.lambda$handle$2(HTTPMessageHandler.java:92) ~[eventmesh-runtime-1.11.0-release.jar:1.11.0-release] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_162] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_162] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_162] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_162] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_162]

Debug logs


Are you willing to submit PR?

  • [x] Yes I am willing to submit a PR!

Code of Conduct

linyf-B avatar May 06 '26 07:05 linyf-B

It has been 90 days since the last activity on this issue. Apache EventMesh values the voices of the community. Please don't hesitate to share your latest insights on this matter at any time, as the community is more than willing to engage in discussions regarding the development and optimization directions of this feature.

If you feel that your issue has been resolved, please feel free to close it. Should you have any additional information to share, you are welcome to reopen this issue.

github-actions[bot] avatar Aug 04 '26 19:08 github-actions[bot]

hi @linyf-B , Are you still working on fixing this issue? If not, I can handle it and submit a PR.

Anon2Tokyo avatar Aug 08 '26 06:08 Anon2Tokyo

Hi @Anon2Tokyo Thanks for checking in! I'm not actively working on this fix right now, so please feel free to take it and submit a PR.

linyf-B avatar Aug 10 '26 01:08 linyf-B

I will work on this.

zhang-arvin avatar Aug 30 '26 15:08 zhang-arvin

This issue is resolved by the uni-architecture rewrite. The AsyncHTTPPushRequest.java and the old org.apache.eventmesh.runtime.core.protocol.http.push package were removed. The new architecture uses LegacyHttpBridge which properly converts legacy HTTP wire format to CloudEvents and uses the new UniIngressService - the ClassCastException (Package vs HttpEventWrapper) cannot occur in the new code path.

Closing as completed by the architecture redesign.

zhang-arvin avatar Aug 30 '26 15:08 zhang-arvin