Spring 启动时出现 React 和 rSocket REQUEST_CHANNEL 错误

React and rSocket REQUEST_CHANNEL error with Spring Boot

我们有一个 React 和 Spring Boot Data Geode 之间的工作演示,使用 rSocket 进行即发即忘、请求响应和请求流,但是当我们尝试使用请求通道时,我们得到错误:

org.springframework.messaging.MessageDeliveryException: Destination 'quotes' does not support REQUEST_CHANNEL. Supported interaction(s): [REQUEST_STREAM]

到目前为止,在网络上看起来应该可以从 RSocket Git

这是一个简单的 spring 启动应用程序,带有 @Controller 端点,运行 通过 rSocket 像这样:

@Controller
public class RSocketController {
    private static final Logger log = LogManager.getLogger(RSocketController.class);

    @Autowired
    PriceService priceService;

    @MessageMapping(value = "quotes")
    public Flux<Quote> getQuotes() {
        log.info("In getQuotes");

        return priceService.generatePrices();
    }  
}

generatePrices returns 价格波动在请求流中运行良好,但我们更愿意使用请求通道进行双向通信。

客户端版本

"rsocket-core": "0.0.19"
"rsocket-flowable": "0.0.14"
"rsocket-tcp-client": "0.0.19"
"rsocket-websocket-client": "0.0.19"

客户代码

const transport = new RSocketWebSocketClient(transportOptions);
const rSocketClient = new RSocketClient({serializers, setup, transport});
​
rSocketClient.connect().subscribe({
    onComplete: socket => {
        console.log('Client connected to the RSocket Server');
​
        socket.requestChannel(Flowable.just({
            data: 'foyss',
            metadata: String.fromCharCode(6) + 'quotes'
        })).subscribe({
            onComplete: function() {
                console.log(`Channel received end of server stream`);
            },
            onError: function(err) {
                console.log("err", err);
            },
            onNext: payload => {
                console.log(payload);
            },                
            onSubscribe: function(subscription) {
                console.log("got subscription");
                subscription.request(0x7fffffff);
            },
            onError: error => {
                console.log(error);
            },
            onSubscribe: cancel => {
                console.log('onSubscribe cancel');
            }})
        },
        onError: error => {
            console.log(error);
        },
        onSubscribe: cancel => {
            // console.log(cancel);
            console.log('onSubscribe cancel');
        }
})

一些 JS 库仍然不支持请求通道模型。请查看您的 JS 库的官方文档,例如:https://www.npmjs.com/package/ng-rsocket-rxjs

Missing:
Lease Handling
Server Setup
Resume Support
Request Channel
.....