springspring-bootspring-data-gemfirersocket

React and rSocket REQUEST_CHANNEL error with Spring Boot


We have a working demo between React and Spring Boot Data Geode using rSocket for fire & forget, request response and request stream but when we try and use request channel we get error:

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

So far on web it looks like this ought to be possible from RSocket Git

It's a simple spring boot app with @Controller endpoints that run over rSocket like this:

@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();
    }  
}

The generatePrices returns a Flux of prices which works fine in request stream but we would prefer to use request channel for bi-directional comms.

Client versions

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

Client code

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');
        }
})

Solution

  • Some JS libraries still don't support the request-channel model. Please check the official documentation for your JS lib, eg, for: https://www.npmjs.com/package/ng-rsocket-rxjs

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