Class 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
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

        io.netty.channel.ChannelHandler.Sharable
    • 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
      • Methods inherited from interface io.netty.channel.ChannelHandler

        handlerRemoved
    • Constructor Detail

      • BulkRestDataSender

        public BulkRestDataSender()
    • Method Detail

      • handlerAdded

        public void handlerAdded​(io.netty.channel.ChannelHandlerContext ctx)
                          throws Exception
        Specified by:
        handlerAdded in interface io.netty.channel.ChannelHandler
        Overrides:
        handlerAdded in class io.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
      • 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.
      • channelRead0

        protected void channelRead0​(io.netty.channel.ChannelHandlerContext ctx,
                                    io.netty.handler.codec.http.FullHttpResponse msg)
                             throws Exception
        Specified by:
        channelRead0 in class io.netty.channel.SimpleChannelInboundHandler<io.netty.handler.codec.http.FullHttpResponse>
        Throws:
        Exception