You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2022/12/03 16:56:20 UTC

[GitHub] [incubator-eventmesh] mistyzyq opened a new issue, #2444: [Bug] wrong protocol type for SendSyncMessageProcessor, and the sync http request throws ProtocolHandleException

mistyzyq opened a new issue, #2444:
URL: https://github.com/apache/incubator-eventmesh/issues/2444

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Environment
   
   Windows
   
   ### EventMesh version
   
   master
   
   ### What happened
   
   I have tried the http.demo project in the eventmesh-examples module, the _SyncRequestInstance_ does not work currently.
   by reading and many debugging work, I found out that, when getProtocolAdaptor(), the protocol type is hardcoded as "cloudevents" in method processRequest() of _Send**Sync**MessageProcessor_ class:
   ```
           ProtocolAdaptor<ProtocolTransportObject> httpCommandProtocolAdaptor = ProtocolPluginFactory.getProtocolAdaptor("cloudevents");
           CloudEvent event = httpCommandProtocolAdaptor.toCloudEvent(asyncContext.getRequest());
   ```
   In SyncRequestInstance, this object of asyncContext.getRequest() is instance of EventMeshMessage, so an exception is thrown when convert it to CloudEvent.
   
   Another example in http.demo, the _AsyncPublishInstance_ works fine, which bind the _Send**Async**MessageProcessor_. In the async processor, the same code block is like this:
   ```
           SendMessageRequestHeader sendMessageRequestHeader = (SendMessageRequestHeader) asyncContext.getRequest().getHeader();
   
           SendMessageResponseHeader sendMessageResponseHeader =
               SendMessageResponseHeader.buildHeader(Integer.valueOf(asyncContext.getRequest().getRequestCode()),
                   eventMeshHTTPServer.getEventMeshHttpConfiguration().eventMeshCluster,
                   IPUtils.getLocalAddress(), eventMeshHTTPServer.getEventMeshHttpConfiguration().eventMeshEnv,
                   eventMeshHTTPServer.getEventMeshHttpConfiguration().eventMeshIDC);
   
           String protocolType = sendMessageRequestHeader.getProtocolType();
           String protocolVersin = sendMessageRequestHeader.getProtocolVersion();
           ProtocolAdaptor<ProtocolTransportObject> httpCommandProtocolAdaptor = ProtocolPluginFactory.getProtocolAdaptor(protocolType);
           CloudEvent event = httpCommandProtocolAdaptor.toCloudEvent(asyncContext.getRequest());
   ```
   
   Should the hard-coded protocol type here be changed to dynamic fetching like this?
   ```
           SendMessageRequestHeader sendMessageRequestHeader = (SendMessageRequestHeader) asyncContext.getRequest().getHeader();
   ```
   
   ### How to reproduce
   
   1. startup the eventmesh-runtime;
   2. start the SyncRequestInstance;
   3. An exception will be thrown:
   io.cloudevents.core.format.EventDeserializationException: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'contentStr': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
    at [Source: (byte[])"contentStr with special protocal"; line: 1, column: 12]
   
   ### Debug logs
   
   output in the console: 
   
   > Task :eventmesh-starter:StartUp.main()
   00:54:42.117 [eventMesh-sendMsg-] ERROR org.apache.eventmesh.runtime.boot.EventMeshHTTPServer - process error
   org.apache.eventmesh.protocol.api.exception.ProtocolHandleException: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'contentStr': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
    at [Source: (byte[])"contentStr with special protocal"; line: 1, column: 12]
   	at org.apache.eventmesh.protocol.cloudevents.resolver.http.SendMessageRequestProtocolResolver.buildEvent(SendMessageRequestProtocolResolver.java:105) ~[eventmesh-protocol-cloudevents-1.3.0-release.jar:1.3.0-release]
   	at org.apache.eventmesh.protocol.cloudevents.CloudEventsProtocolAdaptor.deserializeHttpProtocol(CloudEventsProtocolAdaptor.java:98) ~[eventmesh-protocol-cloudevents-1.3.0-release.jar:1.3.0-release]
   	at org.apache.eventmesh.protocol.cloudevents.CloudEventsProtocolAdaptor.toCloudEvent(CloudEventsProtocolAdaptor.java:76) ~[eventmesh-protocol-cloudevents-1.3.0-release.jar:1.3.0-release]
   	at org.apache.eventmesh.runtime.core.protocol.http.processor.SendSyncMessageProcessor.processRequest(SendSyncMessageProcessor.java:94) ~[eventmesh-runtime-1.3.0-release.jar:1.3.0-release]
   	at org.apache.eventmesh.runtime.boot.AbstractHTTPServer$HTTPHandler.lambda$processEventMeshRequest$1(AbstractHTTPServer.java:501) ~[eventmesh-runtime-1.3.0-release.jar:1.3.0-release]
   	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_202]
   	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_202]
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_202]
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_202]
   	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202]
   Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'contentStr': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
    at [Source: (byte[])"contentStr with special protocal"; line: 1, column: 12]
   	at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2391) ~[jackson-core-2.13.0.jar:2.13.0]
   	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:745) ~[jackson-core-2.13.0.jar:2.13.0]
   	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._reportInvalidToken(UTF8StreamJsonParser.java:3634) ~[jackson-core-2.13.0.jar:2.13.0]
   	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2734) ~[jackson-core-2.13.0.jar:2.13.0]
   	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:902) ~[jackson-core-2.13.0.jar:2.13.0]
   	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:794) ~[jackson-core-2.13.0.jar:2.13.0]
   	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4762) ~[jackson-databind-2.13.0.jar:2.13.0]
   	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4668) ~[jackson-databind-2.13.0.jar:2.13.0]
   	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3691) ~[jackson-databind-2.13.0.jar:2.13.0]
   	at io.cloudevents.jackson.JsonFormat.deserialize(JsonFormat.java:99) ~[cloudevents-json-jackson-2.2.0.jar:?]
   	at org.apache.eventmesh.protocol.cloudevents.resolver.http.SendMessageRequestProtocolResolver.buildEvent(SendMessageRequestProtocolResolver.java:66) ~[eventmesh-protocol-cloudevents-1.3.0-release.jar:1.3.0-release]
   	... 9 more
   
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!


-- 
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: dev-unsubscribe@eventmesh.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] github-actions[bot] commented on issue #2444: [Bug] wrong protocol type for SendSyncMessageProcessor, and the sync http request throws ProtocolHandleException

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #2444:
URL: https://github.com/apache/incubator-eventmesh/issues/2444#issuecomment-1336197820

   Welcome to the Apache EventMesh (incubating) community!!
   We are glad that you are contributing by opening this issue. :D
   
   Please make sure to include all the relevant context.
   We will be here shortly.
   
   If you are interested in contributing to our project, please let us know!
   You can check out our contributing guide on [contributing to EventMesh](https://github.com/apache/incubator-eventmesh/blob/develop/CONTRIBUTING.md).
   
   Want to get closer to the community?
   
   WeChat Group:
   ![wechat_qr](https://github.com/apache/incubator-eventmesh/blob/master/docs/images/contact/wechat-assistant.jpg?raw=true)
   
   Mailing Lists:
   | Name | Description |Subscribe	|Unsubscribe|Archive
   | ----    | ----    |----    | ----    | ----    |
   |Users	|User support and questions mailing list|	[Subscribe](mailto:users-subscribe@eventmesh.incubator.apache.org)	|[Unsubscribe](mailto:users-unsubscribe@eventmesh.incubator.apache.org)	|[Mail Archives](https://lists.apache.org/list.html?users@eventmesh.apache.org)|
   |Development	|Development related discussions|	[Subscribe](mailto:dev-subscribe@eventmesh.incubator.apache.org)	|[Unsubscribe](mailto:dev-unsubscribe@eventmesh.incubator.apache.org)	|[Mail Archives](https://lists.apache.org/list.html?dev@eventmesh.apache.org)|
   |Commits	|All commits to repositories|	[Subscribe](mailto:commits-subscribe@eventmesh.incubator.apache.org)	|[Unsubscribe](mailto:commits-unsubscribe@eventmesh.incubator.apache.org)	|[Mail Archives](https://lists.apache.org/list.html?commits@eventmesh.apache.org)|


-- 
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: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


Re: [I] [Bug] wrong protocol type for SendSyncMessageProcessor, and the sync http request throws ProtocolHandleException (eventmesh)

Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia closed issue #2444: [Bug] wrong protocol type for SendSyncMessageProcessor, and the sync http request throws ProtocolHandleException
URL: https://github.com/apache/eventmesh/issues/2444


-- 
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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [I] [Bug] wrong protocol type for SendSyncMessageProcessor, and the sync http request throws ProtocolHandleException (eventmesh)

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #2444:
URL: https://github.com/apache/eventmesh/issues/2444#issuecomment-2070571990

   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.


-- 
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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] xwm1992 commented on issue #2444: [Bug] wrong protocol type for SendSyncMessageProcessor, and the sync http request throws ProtocolHandleException

Posted by GitBox <gi...@apache.org>.
xwm1992 commented on issue #2444:
URL: https://github.com/apache/incubator-eventmesh/issues/2444#issuecomment-1336916061

   @mistyzyq Http protocol has not supported sync request/reply yet, onty tcp/grpc supported the sync request.


-- 
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: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] mistyzyq commented on issue #2444: [Bug] wrong protocol type for SendSyncMessageProcessor, and the sync http request throws ProtocolHandleException

Posted by GitBox <gi...@apache.org>.
mistyzyq commented on issue #2444:
URL: https://github.com/apache/incubator-eventmesh/issues/2444#issuecomment-1336954097

   > @mistyzyq Http protocol has not supported sync request/reply yet, onty tcp/grpc supported the sync request.
   
   I see... So why is there such sample code? 
   I'm such a hapless guy, It was my first time trying to use eventmesh and was confused all day because of it. And, after my modifications, it seems to work fine!


-- 
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: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org