Rsocket服务器异常:没有针对目标''的处理程序(目标未从客户端传递到服务器) [英] Rsocket Server exception: No handler for destination '' (destination does not pass from client to server)

查看:127
本文介绍了Rsocket服务器异常:没有针对目标''的处理程序(目标未从客户端传递到服务器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为RSocket消息编写了一个演示

I wrote a little demo for RSocket message

问题是我无法访问Rsocket端点, 我从服务器收到以下异常:

The problem is that I am unable to access the Rsocket endpoint, I get the following exception from the server:

客户端: 配置:

@Bean
RSocket rSocket() {
    return RSocketFactory.connect()
            .mimeType(MimeTypeUtils.APPLICATION_JSON_VALUE, MimeTypeUtils.APPLICATION_JSON_VALUE)
            .frameDecoder(PayloadDecoder.ZERO_COPY)
            .transport(TcpClientTransport.create(new InetSocketAddress(7500)))
            .start()
            .block();
}

@Bean
RSocketRequester requester(RSocketStrategies strategies) {
    return RSocketRequester.wrap(rSocket(), MimeTypeUtils.APPLICATION_JSON, MimeTypeUtils.APPLICATION_JSON, strategies);
}

控制器:

private final RSocketRequester requester;

@GetMapping("/greet/{name}")
public Publisher<GreetingsResponse> greet(@PathVariable String name) {
    return requester
            .route("hello")
            .data(new GreetingsRequest(name))
            .retrieveMono(GreetingsResponse.class);
}

服务器端(使用spring Rsocket): yml:

The server side(using spring Rsocket): yml:

spring:
  rsocket:
    server:
      port: 7500
      transport: tcp
  main:
    lazy-initialization: true

配置:

@MessageMapping("hello")
Mono<GreetingsResponse> greet(GreetingsRequest request) {
    return Mono.just(new GreetingsResponse("Hello " + request.getName() + " @ " + Instant.now()));
} 

我很确定它与新的wrap函数RSocketRequester.wrap有关 由于它接受新参数metadataMimeType,因此将其设置为application/Json, 但这似乎不起作用

I am pretty sure it has something to do with the new wrap function, RSocketRequester.wrap as it accepts a new parameter metadataMimeType, I set it to application/Json, but it does not seems to work

stackTrace:

org.springframework.messaging.MessageDeliveryException:没有用于的处理程序 目的地" org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler.handleNoMatch(RSocketMessageHandler.java:312) 在 org.springframework.messaging.handler.invocation.reactive.AbstractMethodMessageHandler.getHandlerMethod(AbstractMethodMessageHandler.java:445) 在 org.springframework.messaging.handler.invocation.reactive.AbstractMethodMessageHandler.handleMessage(AbstractMethodMessageHandler.java:417) 在 org.springframework.messaging.rsocket.annotation.support.MessagingRSocket.lambda $ handleAndReply $ 4(MessagingRSocket.java:173) 在react..core.publisher.MonoDefer.subscribe(MonoDefer.java:44)处 react..core.publisher.Mono.subscribe(Mono.java:3920)在 Reactor.core.publisher.FluxConcatArray $ ConcatArraySubscriber.onComplete(FluxConcatArray.java:207) 在 Reactor.core.publisher.FluxConcatArray.subscribe(FluxConcatArray.java:80) 在 Reactor.core.publisher.MonoFromFluxOperator.subscribe(MonoFromFluxOperator.java:74) 在 io.rsocket.RSocketResponder.handleRequestResponse(RSocketResponder.java:386) 在io.rsocket.RSocketResponder.handleFrame(RSocketResponder.java:298) 在 Reactor.core.publisher.LambdaSubscriber.onNext(LambdaSubscriber.java:160) 在 Reactor.core.publisher.MonoFlatMapMany $ FlatMapManyInner.onNext(MonoFlatMapMany.java:238) 在 Reactor.core.publisher.FluxGroupBy $ UnicastGroupedFlux.drainRegular(FluxGroupBy.java:554) 在 Reactor.core.publisher.FluxGroupBy $ UnicastGroupedFlux.drain(FluxGroupBy.java:630) 在 Reactor.core.publisher.FluxGroupBy $ UnicastGroupedFlux.subscribe(FluxGroupBy.java:696) 在react..core.publisher.Flux.subscribe(Flux.java:8000)处 Reactor.core.publisher.MonoFlatMapMany $ FlatMapManyMain.onNext(MonoFlatMapMany.java:184) 在 Reactor.core.publisher.Operators $ MonoSubscriber.complete(Operators.java:1582) 在 Reactor.core.publisher.MonoProcessor.onNext(MonoProcessor.java:316) 在 io.rsocket.internal.ClientServerInputMultiplexer.lambda $ new $ 1(ClientServerInputMultiplexer.java:116) 在 Reactor.core.publisher.LambdaSubscriber.onNext(LambdaSubscriber.java:160) 在 Reactor.core.publisher.FluxGroupBy $ GroupByMain.drainLoop(FluxGroupBy.java:380) 在 Reactor.core.publisher.FluxGroupBy $ GroupByMain.drain(FluxGroupBy.java:316) 在 Reactor.core.publisher.FluxGroupBy $ GroupByMain.onNext(FluxGroupBy.java:201) 在 Reactor.core.publisher.FluxMap $ MapSubscriber.onNext(FluxMap.java:114) 在 Reactor.core.publisher.FluxMap $ MapSubscriber.onNext(FluxMap.java:114) 在 react.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:206) 在 react.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:322) 在 react.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:342) 在 Reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:91) 在 io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) 在 io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) 在 io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) 在 io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:328) 在 io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:302) 在 io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) 在 io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) 在 io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) 在 io.netty.channel.DefaultChannelPipeline $ HeadContext.channelRead(DefaultChannelPipeline.java:1421) 在 io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) 在 io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) 在 io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930) 在 io.netty.channel.nio.AbstractNioByteChannel $ NioByteUnsafe.read(AbstractNioByteChannel.java:163) 在 io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:697) 在 io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:632) 在 io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:549) 在io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:511)处 io.netty.util.concurrent.SingleThreadEventExecutor $ 5.run(SingleThreadEventExecutor.java:918) 在 io.netty.util.internal.ThreadExecutorMap $ 2.run(ThreadExecutorMap.java:74) 在 io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) 在java.base/java.lang.Thread.run(Thread.java:834)

org.springframework.messaging.MessageDeliveryException: No handler for destination '' at org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler.handleNoMatch(RSocketMessageHandler.java:312) at org.springframework.messaging.handler.invocation.reactive.AbstractMethodMessageHandler.getHandlerMethod(AbstractMethodMessageHandler.java:445) at org.springframework.messaging.handler.invocation.reactive.AbstractMethodMessageHandler.handleMessage(AbstractMethodMessageHandler.java:417) at org.springframework.messaging.rsocket.annotation.support.MessagingRSocket.lambda$handleAndReply$4(MessagingRSocket.java:173) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44) at reactor.core.publisher.Mono.subscribe(Mono.java:3920) at reactor.core.publisher.FluxConcatArray$ConcatArraySubscriber.onComplete(FluxConcatArray.java:207) at reactor.core.publisher.FluxConcatArray.subscribe(FluxConcatArray.java:80) at reactor.core.publisher.MonoFromFluxOperator.subscribe(MonoFromFluxOperator.java:74) at io.rsocket.RSocketResponder.handleRequestResponse(RSocketResponder.java:386) at io.rsocket.RSocketResponder.handleFrame(RSocketResponder.java:298) at reactor.core.publisher.LambdaSubscriber.onNext(LambdaSubscriber.java:160) at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onNext(MonoFlatMapMany.java:238) at reactor.core.publisher.FluxGroupBy$UnicastGroupedFlux.drainRegular(FluxGroupBy.java:554) at reactor.core.publisher.FluxGroupBy$UnicastGroupedFlux.drain(FluxGroupBy.java:630) at reactor.core.publisher.FluxGroupBy$UnicastGroupedFlux.subscribe(FluxGroupBy.java:696) at reactor.core.publisher.Flux.subscribe(Flux.java:8000) at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onNext(MonoFlatMapMany.java:184) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1582) at reactor.core.publisher.MonoProcessor.onNext(MonoProcessor.java:316) at io.rsocket.internal.ClientServerInputMultiplexer.lambda$new$1(ClientServerInputMultiplexer.java:116) at reactor.core.publisher.LambdaSubscriber.onNext(LambdaSubscriber.java:160) at reactor.core.publisher.FluxGroupBy$GroupByMain.drainLoop(FluxGroupBy.java:380) at reactor.core.publisher.FluxGroupBy$GroupByMain.drain(FluxGroupBy.java:316) at reactor.core.publisher.FluxGroupBy$GroupByMain.onNext(FluxGroupBy.java:201) at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114) at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:114) at reactor.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:206) at reactor.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:322) at reactor.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:342) at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:91) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:328) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:302) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1421) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:697) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:632) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:549) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:511) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:834)

推荐答案

您使用的是哪个春季版本? 我有一个相同的问题,我通过更改spring-boot-starter-parent 2.2.0.M3来解决了.

Which spring version are you using? I had a same issue and I solved it by changing spring-boot-starter-parent 2.2.0.M3.

这是我的出处 https://github.com/han1448/spring-rsocket-example

已添加.

我解决了这个问题.您需要将mimeType更改为message/x.rsocket.routing.v0. 您可以从MetadataExtractor.ROUTING获取此mimeType.

I solved this issue. You need to change mimeType to message/x.rsocket.routing.v0. You can get this mimeType from MetadataExtractor.ROUTING.

@Bean
RSocket rSocket() {
    return RSocketFactory.connect()
            .mimeType(MetadataExtractor.ROUTING.toString(), MimeTypeUtils.APPLICATION_JSON_VALUE)
            .frameDecoder(PayloadDecoder.ZERO_COPY)
            .transport(TcpClientTransport.create(new InetSocketAddress(7500)))
            .start()
            .block();
}

@Bean
RSocketRequester requester(RSocketStrategies strategies) {
    return RSocketRequester.wrap(rSocket(), MimeTypeUtils.APPLICATION_JSON, MetadataExtractor.ROUTING, strategies);
}

这篇关于Rsocket服务器异常:没有针对目标''的处理程序(目标未从客户端传递到服务器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆