https://github.com/vaibhav-sinha/spring-remoting-grpc
This library enables using Spring Remoting with gRPC as the underlying transport.
https://github.com/vaibhav-sinha/spring-remoting-grpc
grpc grpc-java java java8 protobuf protobuf3 remoting rpc spring springframework
Last synced: 29 days ago
JSON representation
This library enables using Spring Remoting with gRPC as the underlying transport.
- Host: GitHub
- URL: https://github.com/vaibhav-sinha/spring-remoting-grpc
- Owner: vaibhav-sinha
- License: apache-2.0
- Created: 2017-07-09T19:31:33.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-15T17:42:13.000Z (almost 9 years ago)
- Last Synced: 2025-07-29T17:40:24.498Z (10 months ago)
- Topics: grpc, grpc-java, java, java8, protobuf, protobuf3, remoting, rpc, spring, springframework
- Language: Java
- Homepage:
- Size: 9.77 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spring Remoting gRPC
This library enables using Spring Remoting with gRPC as the underlying transport.
## Installation
The artifact is available on Maven Central Repository and can be downloaded by adding the following dependency in pom.xml
com.github.vaibhav-sinha
spring-remoting-grpc
0.1.0
## Usage
Create a Service Exporter bean in the context of the service you want to expose
@Bean
public GrpcInvokerServiceExporter userServiceServer() {
GrpcInvokerServiceExporter grpcInvokerServiceExporter = new GrpcInvokerServiceExporter();
grpcInvokerServiceExporter.setServiceInterface(UserService.class);
grpcInvokerServiceExporter.setService(userService());
grpcInvokerServiceExporter.setPort(8888);
return grpcInvokerServiceExporter;
}
Create a Proxy of the service on the client end
@Bean
public UserService userServiceClient() throws Exception {
return (UserService) grpcInvokerProxyFactoryBean().getObject();
}
@Bean
public GrpcInvokerProxyFactoryBean grpcInvokerProxyFactoryBean() {
GrpcInvokerProxyFactoryBean grpcInvokerProxyFactoryBean = new GrpcInvokerProxyFactoryBean();
grpcInvokerProxyFactoryBean.setServiceUrl("localhost:8888");
grpcInvokerProxyFactoryBean.setServiceInterface(UserService.class);
return grpcInvokerProxyFactoryBean;
}
Look in the tests to find the complete example.