Ejemplo n.º 1
0
  @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);
    }
  }
Ejemplo n.º 2
0
 @Override
 public void writeTo(StreamOutput stream) throws IOException {
   stream.writeStreamableOrNull(message);
 }
Ejemplo n.º 3
0
 @Override
 public void writeTo(StreamOutput stream) throws IOException {
   stream.writeUUIDOrNull(uuid);
   stream.writeEnumOrNull(type);
   stream.writeByteBufOrNull(buffer);
 }
Ejemplo n.º 4
0
 @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);
 }