Skip to content

RSocket Functional route & Kotlin DSL #23135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
linux-china opened this issue Jun 13, 2019 · 2 comments
Open

RSocket Functional route & Kotlin DSL #23135

linux-china opened this issue Jun 13, 2019 · 2 comments
Labels
in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement

Comments

@linux-china
Copy link

linux-china commented Jun 13, 2019

Now functional route is useful feature for Spring WebFlux and SpringMVC, and it's possible to add this feature for RSocket? Functional route is very convenient with functional style, especially for Kotlin, and all are functions and messages/events.

    @Bean
    public RouterFunction locateRoutes() {
        return RouterFunctions
                .route(RPC("findId"), payload -> Mono.just(DefaultPayload.create("hello")))
                .andRoute(FIRE("notifyLogin"), payload -> Mono.empty())
                .andRoute(STREAM("accounts"), payload -> Flux.empty());
    }

Two hard things: MessageMapping and payload data serialization. I like following style, and it's very useful sometimes.

    @MessageMapping("users.{user}.info")
    Mono<ChatUserInfo> getUserInfo(@DestinationVariable String user, Body body) {
        // ...
    }
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 13, 2019
@sdeleuze
Copy link
Contributor

@rstoyanchev Is RSocketRequester the recommended functional alternative to MessageMapping? If yes, how @MessageMapping("users.{user}.info") and @DestinationVariable would translate? Is there some special configuration to use for enabling composite metadata?

@sdeleuze sdeleuze added in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 20, 2019
@sdeleuze sdeleuze added this to the 5.x Backlog milestone Jun 20, 2019
@sdeleuze
Copy link
Contributor

After discussing that with @rstoyanchev, we indeed miss a functional way to define RSocket routes. I think it is a too late for 5.2, but it would perfectly makes sense for 5.3 IMO. This should be implemented in Java with an additional Kotlin DSL like what with did on WebFlux.fn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants