Search in sources :

Example 1 with StreamReader

use of com.linkedin.r2.netty.entitystream.StreamReader in project rest.li by linkedin.

the class ClientEntityStreamHandler method write.

@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
    if (msg instanceof StreamRequest) {
        StreamRequest request = (StreamRequest) msg;
        // Sets reader after the headers have been flushed on the channel
        OrderedEntityStreamReader orderedReader = new OrderedEntityStreamReader(ctx, new StreamReader(ctx));
        ctx.write(request).addListener(future -> request.getEntityStream().setReader(orderedReader));
    } else {
        ctx.write(msg);
    }
}
Also used : OrderedEntityStreamReader(com.linkedin.r2.transport.http.client.stream.OrderedEntityStreamReader) StreamReader(com.linkedin.r2.netty.entitystream.StreamReader) OrderedEntityStreamReader(com.linkedin.r2.transport.http.client.stream.OrderedEntityStreamReader) StreamRequest(com.linkedin.r2.message.stream.StreamRequest)

Aggregations

StreamRequest (com.linkedin.r2.message.stream.StreamRequest)1 StreamReader (com.linkedin.r2.netty.entitystream.StreamReader)1 OrderedEntityStreamReader (com.linkedin.r2.transport.http.client.stream.OrderedEntityStreamReader)1