我有一个简单的Spring boot RSocket服务
@MessageMapping("msend")
public Flux<String> msend(String message) {
log.info("msend channel publish " + message);
return Flux.just(message, " "+System.currentTimeMillis());
}连接两个Spring服务很容易,但是我的客户端应用程序没有spring,我的客户端应该使用RSocket java
我很难理解如何将消息(像Spring RsocketRequester一样)发送到那个特定的通道。
客户端代码应为:
Mono<RSocket> rsocket = RSocketConnector.create()
.metadataMimeType(WellKnownMimeType.MESSAGE_RSOCKET_COMPOSITE_METADATA.getString())
.connect(TcpClientTransport.create(2050));
///real path "http://gateway:2022/producer/toProducerRsocket", 2050)
///toProducerRsocket redirect to producer/rsocket有没有可能订阅Spring频道?
发布于 2021-01-19 02:56:25
这对于定义元数据类型看起来是正确的。但是您需要为请求流设置它。通道在这里听起来不正确,因为您只有一条输入值消息。
https://stackoverflow.com/a/62776146/1542667
CompositeByteBuf metadata = ByteBufAllocator.DEFAULT.compositeBuffer();
RoutingMetadata routingMetadata = TaggingMetadataCodec.createRoutingMetadata(ByteBufAllocator.DEFAULT, List.of("/route"));
CompositeMetadataCodec.encodeAndAddMetadata(metadata,
ByteBufAllocator.DEFAULT,
WellKnownMimeType.MESSAGE_RSOCKET_ROUTING,
routingMetadata.getContent());https://stackoverflow.com/questions/65780058
复制相似问题