You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
The standard [RSocket](http://rsocket.io) RPC Java implementation.
5
5
6
6
## Build from Source
7
+
7
8
1. Building rsocket-rpc-java requires installation of the [Protobuf](https://github.com/google/protobuf) compiler. RSocket RPC requires Protobuf 3.6.x or higher.
8
9
9
10
For Mac users you can easily install the Protobuf compiler using Homebrew:
@@ -15,8 +16,18 @@ The standard [RSocket](http://rsocket.io) RPC Java implementation.
15
16
2. Run the following Gradle command to build the project:
16
17
17
18
$ ./gradlew clean build
19
+
20
+
## What Next?
21
+
22
+
*[Motivation](./docs/motivation.md)
23
+
*[Get Started](./docs/get-started.md)
24
+
25
+
## Release Notes
26
+
27
+
Please find release notes at [https://github.com/rsocket/rsocket-rpc-java/releases](https://github.com/rsocket/rsocket-rpc-java/releases).
18
28
19
29
## Bugs and Feedback
30
+
20
31
For bugs, questions, and discussions please use the [Github Issues](https://github.com/netifi/rsocket-rpc-java/issues).
Copy file name to clipboardExpand all lines: docs/get-started.md
+51-69Lines changed: 51 additions & 69 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,7 @@
1
-
RSocket RPC Java
1
+
# Get Started with RSocket RPC Java
2
+
3
+
In this section we are going to learn the essential of RSocket-RPC and its implementation in Java
4
+
2
5
## Introduction
3
6
RSocket RPC is an easy to use RPC layer that sits on top of [RSocket](http://rsocket.io). RSocket is a binary protocol for use on byte stream transports such as TCP, WebSockets, and [Aeron](https://github.com/real-logic/aeron). RSocket RPC is able to leverage RSockets unique features allowing you develop complex realtime, streaming applications without needing Kafka, Spark, etc. It is completely non-blocking and reactive making it responsive and high performance.
Each generated service has a client and server implementation generated for you. After you have implemented the generated interface you need to hand the implementation to the server. See the below example:
239
249
```
240
-
SimpleServiceServer serviceServer = new SimpleServiceServer(new DefaultSimpleService());
250
+
SimpleServiceServer serviceServer = new SimpleServiceServer(new DefaultSimpleService(), Optional.empty(), Optional.empty());
241
251
```
242
252
243
-
Once you have created an instance of the the server you need to configure RSocket. The server can either be configured the RSocket that receives the connection or the RSocket that makes the connection. The following examples uses TCP, but can use other transports as well. The example also uses the optional `RequestHandlingRSocket`. The `RequestHandlingRSocket` is a special RSocket that will allow you to support more than one RSocket RPC Server implementation on the same RSocket connection. If you don't need to support more than one socket you don't need to use it. Just return the generated server directly.
253
+
Once you have created an instance of the the server you need to configure RSocket. The
254
+
following is a RSocket server configuration
244
255
245
-
#### RSocket Server Configuration
246
-
This configures the receiver of a connection, typically a server, to handle requests to the `SimeplService` implementation.
247
-
```
248
-
SimpleServiceServer serviceServer = new SimpleServiceServer(new DefaultSimpleService());
This configures a initiator of a connection, typically a client, to handle requests to the `SimpleService` implementation.
261
-
```
262
-
SimpleServiceServer serviceServer = new SimpleServiceServer(new DefaultSimpleService());
267
+
#### RSocket RPC Client common Configuration
268
+
The RSocket RPC compiler generates a client as well as a server. The client implements the generated interface. You can configure the client either from an RSocket client connection, or server connection. The following shows how to configure a initiator of a connection, typically a client, to send requests to the `SimpleService` implementation.
263
269
264
-
RSocketFactory
265
-
.connect()
266
-
.acceptor(rSocket -> new RequestHandlingRSocket(serviceServer))
The RSocket RPC compiler generates a client as well as a server. The client implements the generated interface. You can configure the client either from an RSocket client connection, or server connection.
274
-
275
-
#### RSocket Server Configuration
279
+
#### RSocket RPC client over Server Configuration
276
280
This configures the receiver of a connection, typically a server, to call the remote `SimpleService`. Notice that the client is created inside the closure in the acceptor method. The method passes in a variable called `sendingSocket`. This is the RSocket that is the connection to the client. You can make calls to the client *without* receiving requests first, or ever.
277
281
```
278
282
RSocketFactory.receive()
@@ -297,17 +301,8 @@ RSocketFactory.receive()
297
301
.block();
298
302
```
299
303
300
-
#### RSocket Client Configuration
301
-
This configures an initiator of a connection, typically a client, to call the remote `SimpleService`.
The above example streams in 11 items to a server. The server receives the stream, counts the most common words, and then returns a message detailing the data received.
325
-
326
-
## Release Notes
327
-
328
-
Please find release notes at [https://github.com/netifi/rsocket-rpc-java/releases](https://github.com/netifi/rsocket-rpc-java/releases).
329
-
330
-
## Bugs and Feedback
331
-
332
-
For bugs, questions, and discussions please use the [Github Issues](https://github.com/netifi/rsocket-rpc-java/issues).
333
-
334
-
## License
335
-
Copyright 2017 Netifi Inc.
336
-
337
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
319
+
The above example streams in 11 items to a server. The server receives the stream, counts the most common words, and then returns a message detailing the data received.
338
320
339
-
http://www.apache.org/licenses/LICENSE-2.0
321
+
## Next Steps
340
322
341
-
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
323
+
See `rsocket-rpc-examples`for more examples and use-cases.
As many of us might know, there is an RPC project called gRPC. The gRPC project allows us easily setup RPC communication between several services. Even though the communication is reactive, asynchronous and non-blocking, the current implementation of gRPC does not allow to achieve one of the central goals for Reactive Streams - Backpressure control. At that moment, gRPC uses HTTP/2 as a transport and employee its flow control in order to achieve backpressure. HTTP/2 flow allows only byte-acknowledgment-based flow control, which means there is no specific part of the protocol that can say how many logical-elements a consumer ready to accept. That limitation may impact system stability under high-load which may be either performance degradation or resilience degradation.
4
+
5
+
Therefore, RSocket-RPC comes for rescue. The central idea of RSocket-RPC is to provide identical communication features as there are in gRPC. As we might remember, gRPC offers Protocol Buffer integration, which along with common data structures generation, allows generating stubs for services. The RSocket-RPC library employees the same techniques and provides the same plugin for stub generation. In turn, RSocket-RPC uses RSocket protocol as an application level transport for message exchange which includes out-of-the-box logical-elements-based backpressure control, therefore offers better resilience without impact on system's performance.
6
+
7
+
Also, RSocket-RPC is language agnostic and at the current moment provides integration with [JavaScript](https://github.com/rsocket/rsocket-rpc-js) as well as with [Java](https://github.com/rsocket/rsocket-rpc-java).
0 commit comments