无法通过 RSC cli 发送客户端请求
Not able to send client Request through 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.
那你就可以确认是服务器的问题了,你应该去调试一下服务器为什么会崩溃。
我正在使用一个简单的 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.
那你就可以确认是服务器的问题了,你应该去调试一下服务器为什么会崩溃。