Skip to content

Support to Create Proxy for RSocket Client From Annotated Interface #24456

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

Closed
linux-china opened this issue Jan 29, 2020 · 7 comments
Closed
Assignees
Labels
in: messaging Issues in messaging modules (jms, messaging) type: enhancement A general enhancement
Milestone

Comments

@linux-china
Copy link

Now we implement the RSocket service like this:

  • Reactive service interface
public interface AccountService {
    Mono<Account> findById(Integer id);
    Flux<Account> findAll();
}
  • Service implementation with RSocket Exposed
@Controller
@MessageMapping("org.xxxxx.account.AccountService")
public class AccountServiceImpl implements AccountService {
    @Override
    @MessageMapping("findById")
    public Mono<Account> findById(Integer id) {
        return Mono.just(new Account(id, "nick:" + id));
    }
    @Override
    @MessageMapping("findAll")
    public Flux<Account> findAll() {
        return Flux.just(new Account(1, "Jackie"), new Account(2, "Tom"));
    }
}
  • Client call with Java Proxy InvocationHandler
return (T) Proxy.newProxyInstance(
                serviceInterface.getClassLoader(),
                new Class[]{serviceInterface},
                new RSocketReactiveServiceProxy(rsocketRequester, serviceInterface, timeout));
   

Any plan to support this feature by default to make it easy for Java Developers. Now RsocketRequester is alike WebClient, but every developer can understand HTTP, and it's hard to developer to understand RSocket protocol.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 29, 2020
@rstoyanchev
Copy link
Contributor

I think this would be useful for an RPC mechanism to have such a contract-driven approach.

@rstoyanchev rstoyanchev 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 Feb 3, 2020
@rstoyanchev rstoyanchev added this to the 5.x Backlog milestone Feb 3, 2020
@spencergibb
Copy link
Member

@linux-china
Copy link
Author

https://github.com/spring-projects-experimental/spring-retrosocket /cc @joshlong

@spencergibb It's correct. Now I use retrosocket for demo and introduce it to other developers.

@kitkars
Copy link

kitkars commented Mar 4, 2021

@linux-china @spencergibb
is this retrosocket still under development?

@spencergibb
Copy link
Member

@kitkars it's experimental and maintained by @joshlong

@kitkars
Copy link

kitkars commented Mar 5, 2021

Looks like a great feature to have! Thanks for confirming.
@spencergibb

@rstoyanchev rstoyanchev modified the milestones: 6.x Backlog, 6.0.0-M4 Mar 18, 2022
@rstoyanchev rstoyanchev self-assigned this Mar 18, 2022
@rstoyanchev rstoyanchev modified the milestones: 6.0.0-M4, 6.0.0-M5 Apr 26, 2022
@rstoyanchev rstoyanchev modified the milestones: 6.0.0-M5, 6.0.0-M6 Jul 11, 2022
@rstoyanchev rstoyanchev changed the title Make RSocket call interface based Support to Create Proxy for RSocket Client From Annotated Interface Sep 7, 2022
@spencergibb
Copy link
Member

Nice. Well done!

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

5 participants