Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mostroverkhov committed Dec 18, 2021
2 parents a49de54 + 8a5daea commit a2da82e
Show file tree
Hide file tree
Showing 59 changed files with 985 additions and 522 deletions.
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
![Maven Central](https://img.shields.io/maven-central/v/com.jauntsdn.rsocket/rsocket-bom)

# jauntsdn.com / RSocket-JVM

[RSocket](https://jauntsdn.com/post/rsocket-summary/) is low latency/high throughput L5 network protocol,
intended for high-performance services communication. It is transport agnostic, and runs on top
of any reliable byte stream transport.
RSocket-JVM is [very fast](https://jauntsdn.com/post/rsocket-summary/) (millions of messages per core with each interaction) alternative to
projectreactor-only RSocket/RSocket-java from "Reactive Foundation" -
which is plagued by number of performance and security [problems](https://jauntsdn.com/post/rsocket-vs-spring/).

This repository hosts API part of RSocket-JVM - suite of libraries for fast interprocess/network communication using major
Reactive Streams impls.
Reactive Streams implementations.

RSocket is low latency/high throughput L5 network protocol,
intended for high-performance services communication. It is transport agnostic, and runs on top
of any reliable byte stream transport.

RSocket-JVM includes RSocket-RPC: remote procedure call system on top of Protocol Buffers.

### Motivation / Purpose

RSocket-JVM is [very fast](https://jauntsdn.com/post/rsocket-vs-spring/) alternative to
projectreactor-only RSocket/RSocket-java from "Reactive Foundation" -
which is plagued by number of performance and security [problems](https://jauntsdn.com/post/rsocket-million-streams-2/).

**Multiple vendor libraries**. [Shared protocol core](https://jauntsdn.com/post/rsocket-jvm/) with minimal dependencies
(netty-buffer only) streamlined development process for each next vendor library.
(netty-buffer only) streamline development process for each next vendor library.

**Shared transports**. Message byte transports are based on `rsocket-messages` and netty only
so are usable by each vendor library. Transports are considered part of RSocket-JVM runtime.
so usable by each vendor library. Currently transports are comprised of TCP, unix & websocket-over-http2, and
are considered part of RSocket-JVM runtime.

**Non-intrusive**. API & runtime are clearly split so from end-user perspective there is
only defined set of basic interactions on buffers/messages:
Expand All @@ -29,6 +32,10 @@ only defined set of basic interactions on buffers/messages:
Publisher<Message> requestChannel(Publisher<Message> messages);
Publisher<Void> fireAndForget(Message message);
```

**GRPC compatible**. All implementations are directly compatible with GRPC via RSocket-RPC & GRPC transport.
GRPC clients can access such services without separate "gateway" binaries and awkward IDL sharing schemes.

### Project-reactor, rxjava, helidon

RSocket-JVM is currently comprised of RSocket-rxjava (rxjava3), RSocket-reactor (project-reactor), and RSocket-helidon (helidon-commons-reactive).
Expand All @@ -43,7 +50,7 @@ Each vendor library has RSocket-RPC API module accompanied by compiler binary.

### Examples

[RSocket-jvm-interop-demo]().
[RSocket-jvm-interop-examples](https://github.com/jauntsdn/rsocket-jvm-interop-examples).

## Build

Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
group=com.jauntsdn.rsocket
version=1.0.0
version=1.1.0

dependencyManagementPluginVersion=1.0.11.RELEASE
protobufPluginVersion=0.8.17
googleJavaFormatPluginVersion=0.9
gitPluginVersion=0.12.3
versionsPluginVersion=0.39.0

nettyBomVersion=4.1.69.Final
nettyBomVersion=4.1.72.Final
reactorBomVersion=Dysprosium-SR22
rxjavaVersion=3.1.2
rxjavaVersion=3.1.3
helidonCommonReactiveVersion=2.3.4
jsr305Version=3.0.2
javaxInjectVersion=1
javaxAnnotationVersion=1.3.2
protobufVersion=3.19.0
protobufVersion=3.19.1

org.gradle.parallel=true
org.gradle.configureondemand=true
2 changes: 1 addition & 1 deletion rsocket-bom/gradle/dependency-locks/classpath.lockfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
io.netty:netty-bom:4.1.69.Final
io.netty:netty-bom:4.1.72.Final
io.projectreactor:reactor-bom:Dysprosium-SR22
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ io.helidon.common:helidon-common-mapper:2.3.4
io.helidon.common:helidon-common-reactive:2.3.4
io.helidon.common:helidon-common-service-loader:2.3.4
io.helidon.common:helidon-common:2.3.4
io.netty:netty-buffer:4.1.69.Final
io.netty:netty-common:4.1.69.Final
io.netty:netty-buffer:4.1.72.Final
io.netty:netty-common:4.1.72.Final
jakarta.annotation:jakarta.annotation-api:1.3.5
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ io.helidon.common:helidon-common-mapper:2.3.4
io.helidon.common:helidon-common-reactive:2.3.4
io.helidon.common:helidon-common-service-loader:2.3.4
io.helidon.common:helidon-common:2.3.4
io.netty:netty-buffer:4.1.69.Final
io.netty:netty-common:4.1.69.Final
io.netty:netty-buffer:4.1.72.Final
io.netty:netty-common:4.1.72.Final
jakarta.annotation:jakarta.annotation-api:1.3.5
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
/*
* Copyright 2020 - present Maksym Ostroverkhov.
* Copyright 2021 - present Maksym Ostroverkhov.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/

package com.jauntsdn.rsocket;
Expand All @@ -8,39 +20,43 @@
import io.helidon.common.reactive.Single;
import java.util.concurrent.Flow;

/**
* An abstract implementation of {@link RSocket}. All request handling methods emit {@link
* UnsupportedOperationException} and hence must be overridden to provide a valid implementation.
*/
public abstract class AbstractRSocket implements RSocketHandler {

@Override
public Single<Void> fireAndForget(Message message) {
message.release();
return Single.error(new UnsupportedOperationException("Fire and forget not implemented."));
return Single.error(new UnsupportedOperationException("fire-and-forget not implemented"));
}

@Override
public Single<Message> requestResponse(Message message) {
message.release();
return Single.error(new UnsupportedOperationException("Request-Response not implemented."));
return Single.error(new UnsupportedOperationException("request-response not implemented"));
}

@Override
public Multi<Message> requestStream(Message message) {
message.release();
return Multi.error(new UnsupportedOperationException("Request-Stream not implemented."));
return Multi.error(new UnsupportedOperationException("request-stream not implemented"));
}

@Override
public Multi<Message> requestChannel(Flow.Publisher<Message> payloads) {
return Multi.error(new UnsupportedOperationException("Request-Channel not implemented."));
public Multi<Message> requestChannel(Flow.Publisher<Message> messages) {
return Multi.error(
new UnsupportedOperationException("request-channel(messages) not implemented"));
}

@Override
public Multi<Message> requestChannel(Message message, Flow.Publisher<Message> messages) {
message.release();
return Multi.error(
new UnsupportedOperationException("request-channel(message, messages) not implemented"));
}

@Override
public Single<Void> metadataPush(Message message) {
message.release();
return Single.error(new UnsupportedOperationException("Metadata-Push not implemented."));
return Single.error(new UnsupportedOperationException("metadata-push not implemented"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
/*
* Copyright 2020 - present Maksym Ostroverkhov.
* Copyright 2021 - present Maksym Ostroverkhov.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/

package com.jauntsdn.rsocket;

import java.util.function.Function;

/**
* {@code RSocket} is a full duplex protocol where a client and server are identical in terms of
* both having the capability to initiate requests to their peer. This interface provides the
* contract where a client accepts a new {@code RSocket} for sending requests to the peer and
* returns a new {@code RSocket} that will be used to accept requests from it's peer.
*/
public interface ClientAcceptor {

/**
* Accepts a new {@code RSocket} used to send requests to the peer and returns another {@code
* RSocket} that is used for accepting requests from the peer.
*
* @param setup Setup as sent by the client.
* @param requesterRSocket RSocket used to send requests to the peer.
* @return RSocket to accept requests from the peer.
*/
RSocket accept(SetupMessage setup, RSocket requesterRSocket);

/**
* Contract to decorate a {@link ClientAcceptor}, providing access to connection {@code setup}
* information and the ability to also decorate the sockets for requesting and responding.
*
* <p>This can be used as an alternative to individual requester and responder {@link
* RSocket.Interceptor}
*/
@FunctionalInterface
interface Interceptor extends Function<ClientAcceptor, ClientAcceptor> {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2020 - present Maksym Ostroverkhov.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/

package com.jauntsdn.rsocket;

public interface ClientStreamsAcceptor {

MessageStreams accept(SetupMessage setup, MessageStreams requester);
}
26 changes: 17 additions & 9 deletions rsocket-helidon/src/main/java/com/jauntsdn/rsocket/Closeable.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
/*
* Copyright 2020 - present Maksym Ostroverkhov.
* Copyright 2021 - present Maksym Ostroverkhov.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/

package com.jauntsdn.rsocket;

import io.helidon.common.reactive.Single;

/** */
public interface Closeable extends GracefulCloseable {

/**
* Returns a {@code Publisher} that completes when this {@code RSocket} is closed. A {@code
* RSocket} can be closed by explicitly calling {@link RSocket#dispose()} or when the underlying
* transport connection is closed.
*
* @return A {@code Publisher} that completes when this {@code RSocket} close is complete.
*/
Single<Void> onClose();

void dispose();
Expand All @@ -26,4 +30,8 @@ public interface Closeable extends GracefulCloseable {
default void dispose(String reason, boolean isGraceful) {
dispose();
}

default Attributes attributes() {
return Attributes.EMPTY;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2020 - present Maksym Ostroverkhov.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/

package com.jauntsdn.rsocket;

import io.helidon.common.reactive.Multi;
import io.helidon.common.reactive.Single;
import io.netty.buffer.ByteBufAllocator;
import java.util.Optional;
import java.util.concurrent.Flow;
import java.util.concurrent.ScheduledExecutorService;

public interface MessageStreams extends Closeable {

Single<Void> fireAndForget(Message message);

Single<Message> requestResponse(Message message);

Multi<Message> requestStream(Message message);

Multi<Message> requestChannel(Flow.Publisher<Message> messages);

default Optional<Message.Factory> messageFactory() {
return Optional.empty();
}

default Optional<ScheduledExecutorService> scheduler() {
return Optional.empty();
}

default Optional<ByteBufAllocator> allocator() {
return Optional.empty();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2020 - present Maksym Ostroverkhov.
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/

package com.jauntsdn.rsocket;

import io.helidon.common.reactive.Multi;
import java.util.concurrent.Flow;

public interface MessageStreamsHandler extends MessageStreams {

default Multi<Message> requestChannel(Message message, Flow.Publisher<Message> messages) {
return requestChannel(messages);
}
}
Loading

0 comments on commit a2da82e

Please sign in to comment.