Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Java implementation of RSocket

License

NotificationsYou must be signed in to change notification settings

rsocket/rsocket-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Join the chat at https://gitter.im/RSocket/RSocket-Java

RSocket is a binary protocol for use on byte stream transports such as TCP, WebSockets, and Aeron.

It enables the following symmetric interaction models via async message passing over a single connection:

  • request/response (stream of 1)
  • request/stream (finite stream of many)
  • fire-and-forget (no response)
  • event subscription (infinite stream of many)

Learn more athttp://rsocket.io

Build and Binaries

Build Status

⚠️ Themaster branch is now dedicated to development of the1.2.x line.

Releases and milestones are available via Maven Central.

Example:

repositories {    mavenCentral()    maven { url'https://repo.spring.io/milestone' }// Reactor milestones (if needed)}dependencies {    implementation'io.rsocket:rsocket-core:1.2.0-SNAPSHOT'    implementation'io.rsocket:rsocket-transport-netty:1.2.0-SNAPSHOT'}

Snapshots are available viaoss.jfrog.org (OJO).

Example:

repositories {    maven { url'https://maven.pkg.github.com/rsocket/rsocket-java' }    maven { url'https://repo.spring.io/snapshot' }// Reactor snapshots (if needed)}dependencies {    implementation'io.rsocket:rsocket-core:1.2.0-SNAPSHOT'    implementation'io.rsocket:rsocket-transport-netty:1.2.0-SNAPSHOT'}

Development

Install the google-java-format in Intellij, from Plugins preferences.Enable under Preferences -> Other Settings -> google-java-format Settings

Format automatically with

$./gradlew goJF

Debugging

Frames can be printed out to help debugging. Set the loggerio.rsocket.FrameLogger to debug to print the frames.

Requirements

Trivial Client

packageio.rsocket.transport.netty;importio.rsocket.Payload;importio.rsocket.RSocket;importio.rsocket.core.RSocketConnector;importio.rsocket.transport.netty.client.WebsocketClientTransport;importio.rsocket.util.DefaultPayload;importreactor.core.publisher.Flux;importjava.net.URI;publicclassExampleClient {publicstaticvoidmain(String[]args) {WebsocketClientTransportws =WebsocketClientTransport.create(URI.create("ws://rsocket-demo.herokuapp.com/ws"));RSocketclientRSocket =RSocketConnector.connectWith(ws).block();try {Flux<Payload>s =clientRSocket.requestStream(DefaultPayload.create("peace"));s.take(10).doOnNext(p ->System.out.println(p.getDataUtf8())).blockLast();        }finally {clientRSocket.dispose();        }    }}

Zero Copy

By default to make RSocket easier to use it copies the incoming Payload. Copying the payload comes at cost to performanceand latency. If you want to use zero copy you must disable this. To disable copying you must include apayloadDecoderargument in yourRSocketFactory. This will let you manage the Payload without copying the data from the underlyingtransport. You must free the Payload when you are done with themor you will get a memory leak. Used correctly this will reduce latency and increase performance.

Example Server setup

RSocketServer.create(newPingHandler())// Enable Zero Copy        .payloadDecoder(PayloadDecoder.ZERO_COPY)        .bind(TcpServerTransport.create(7878))        .block()        .onClose()        .block();

Example Client setup

RSocketclientRSocket =RSocketConnector.create()// Enable Zero Copy            .payloadDecoder(PayloadDecoder.ZERO_COPY)            .connect(TcpClientTransport.create(7878))            .block();

Bugs and Feedback

For bugs, questions and discussions please use theGithub Issues.

LICENSE

Copyright 2015-2020 the original author or authors.

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, softwaredistributed 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 andlimitations under the License.

Packages

 
 
 

Contributors53

Languages


[8]ページ先頭

©2009-2025 Movatter.jp