@Override protected void encode(ChannelHandlerContext ctx, TransportFrame frame, ByteBuf out) throws Exception { out.writeByte('E'); out.writeByte('Q'); out.writeInt(frame.version().id); out.writeLong(frame.request()); if (frame instanceof StreamableTransportFrame) { // message request // skip size header int sizePos = out.writerIndex(); out.writerIndex(out.writerIndex() + 4); try (StreamOutput output = streamService.output(out)) { Streamable message = ((StreamableTransportFrame) frame).message(); output.writeClass(message.getClass()); output.writeStreamable(message); } int size = out.writerIndex() - sizePos - 4; out.setInt(sizePos, size); } else { // ping request out.writeInt(0); } }
@Override public void writeTo(StreamOutput stream) throws IOException { stream.writeStreamableOrNull(message); }
@Override public void writeTo(StreamOutput stream) throws IOException { stream.writeUUIDOrNull(uuid); stream.writeEnumOrNull(type); stream.writeByteBufOrNull(buffer); }
@Override public void writeTo(StreamOutput stream) throws IOException { stream.writeStreamable(member); }
@Override public void writeTo(StreamOutput stream) throws IOException { stream.writeText(queue); stream.writeUUID(transactionUUID); }