Package org.yamcs.client.base
Class BulkRestDataSender
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpResponse>
-
- org.yamcs.client.base.BulkRestDataSender
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
public class BulkRestDataSender extends io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpResponse>
Used to post large quantities of data to yamcs. The data is sent using HTTP chuncked encoding
-
-
Constructor Summary
Constructors Constructor Description BulkRestDataSender()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
channelRead0(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpResponse msg)
CompletableFuture<byte[]>
completeRequest()
Complete the request by a final empty chunck and return the response from the server.void
handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
void
sendData(byte[] data)
send the next chunk of data.void
sendData(io.netty.buffer.ByteBuf buf)
-
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerRemoved, isSharable
-
-
-
-
Method Detail
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) throws Exception
- Specified by:
handlerAdded
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerAdded
in classio.netty.channel.ChannelHandlerAdapter
- Throws:
Exception
-
sendData
public void sendData(byte[] data) throws ClientException
send the next chunk of data. The caller is blocked if it sends data faster that can be transfered to the server.- Parameters:
data
-- Throws:
ClientException
- when there is an exception sending the data. The exception is also thrown if no data can be sent for 10 seconds
-
sendData
public void sendData(io.netty.buffer.ByteBuf buf) throws ClientException
- Throws:
ClientException
-
completeRequest
public CompletableFuture<byte[]> completeRequest()
Complete the request by a final empty chunck and return the response from the server.- Returns:
- a CompletableFuture that completes once the response from the server has been received.
-
-