微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法通过 RSC cli 发送客户端请求

如何解决无法通过 RSC cli 发送客户端请求

我使用一个简单的 rSocket 服务器来处理客户端请求。使用 RSC cli 发送客户端请求。

java -jar rsc.jar --debug --request --data "{\"message\":\"HiSourav\"}" --route request-response tcp://localhost:7000

上面是我用来发送请求并得到下面提到的错误的命令。

Error: Could not resolve method parameter at index 0 in reactor.core.publisher.Mono<com.example.RsocketTestWithClient.entity.Message> com.example.RsocketTestWithClient.RsocketTestWithClientApplication.requestResponse(com.example.RsocketTestWithClient.entity.Message): Failed to read HTTP message; nested exception is org.springframework.core.codec.DecodingException: JSON decoding error: Unexpected character ('m' (code 109)): was expecting double-quote to start field name; nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('m' (code 109)): was expecting double-quote to start field name
 at [Source: (io.netty.buffer.ByteBufInputStream); line: 1,column: 3]

告诉我您的任何建议。

解决方法

您的错误表明客户端存在问题,

Unexpected character ('m' (code 109)): was expecting double-quote to start field name at [Source: (io.netty.buffer.ByteBufInputStream); line: 1,column: 3]

所以我会尝试确认您发送的内容是否正确。

使用--debug(或--wiretap)输出来确认客户端正确发送了数据。如果你这样做了,例如

$ rsc --request --data "{\"message\":\"HiSourav\"}" --debug tcp://localhost:9000
2020-12-28 08:52:52.158 DEBUG --- [     parallel-2] i.r.FrameLogger : sending -> 
Frame => Stream ID: 1 Type: REQUEST_RESPONSE Flags: 0b100000000 Length: 31
Metadata:

Data:
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 7b 22 6d 65 73 73 61 67 65 22 3a 22 48 69 53 6f |{"message":"HiSo|
|00000010| 75 72 61 76 22 7d                               |urav"}          |
+--------+-------------------------------------------------+----------------+
2020-12-28 08:52:52.448 DEBUG --- [actor-tcp-nio-1] i.r.FrameLogger : receiving -> 
Frame => Stream ID: 1 Type: ERROR Flags: 0b0 Length: 102
Data:

Error: Destination '' does not support REQUEST_RESPONSE. Supported interaction(s): [REQUEST_STREAM]

Use --stacktrace option for details.

然后你可以确认是服务器问题,你应该调试服务器在这里崩溃的原因。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。