-
Notifications
You must be signed in to change notification settings - Fork 357
Using RxNetty for tcp transport #101
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
Conversation
Current TCP transport implementation lacks a few critical features around insights and network flow control. Since RxNetty already has these features, it makes sense to use it.
…cket-java into rxnetty # Conflicts: # reactivesocket-examples/src/main/java/io/reactivesocket/examples/EchoClient.java # reactivesocket-transport-tcp/src/main/java/io/reactivesocket/transport/tcp/client/ClientTcpDuplexConnection.java # reactivesocket-transport-tcp/src/main/java/io/reactivesocket/transport/tcp/client/TcpReactiveSocketConnector.java
…cket-java into rxnetty # Conflicts: # reactivesocket-examples/src/main/java/io/reactivesocket/examples/EchoClient.java # reactivesocket-transport-tcp/src/main/java/io/reactivesocket/transport/tcp/client/ClientTcpDuplexConnection.java # reactivesocket-transport-tcp/src/main/java/io/reactivesocket/transport/tcp/client/TcpReactiveSocketConnector.java
|
||
System.out.println(response); | ||
RxReactiveStreams.toObservable(client.requestResponse(request)) | ||
.map(payload -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example would be a lot nicer with a utility function
.map(PayloadUtil::dataAsString)
Also 2000 era nit that new String() isn't safe without specifying encoding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
My just another rant about ByteBuffer
API, as compared to netty's ByteBuf
API which enables this:
.map(bb -> bb.toString(Charset.defaultCharset())))
😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Also updated to rxnetty-0.5.2-rc.3
@yschimke @stevegury addressed all comments and updated to latest RxNetty |
ByteBuffer data = payload.getData(); | ||
byte[] dst = new byte[data.remaining()]; | ||
data.get(dst); | ||
return new String(dst); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll add a charset in another commit ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Steve - I'm looking out for the EBCDIC users of the world
Problem
Current TCP transport implementation lacks a few critical features around insights and network flow control.
Solution
Since RxNetty already has these features, it makes sense to use it.
This is a backward incompatible change as it removes some public classes
EchoClient
in examples module contains the usage example.