public static ByteBuf serializeSingleMessageInBatchWithPayload( PulsarApi.SingleMessageMetadata.Builder singleMessageMetadataBuilder, ByteBuf payload, ByteBuf batchBuffer) { int payLoadSize = payload.readableBytes(); PulsarApi.SingleMessageMetadata singleMessageMetadata = singleMessageMetadataBuilder.setPayloadSize(payLoadSize) .build(); // serialize meta-data size, meta-data and payload for single message in batch int singleMsgMetadataSize = singleMessageMetadata.getSerializedSize(); try { batchBuffer.writeInt(singleMsgMetadataSize); ByteBufCodedOutputStream outStream = ByteBufCodedOutputStream.get(batchBuffer); singleMessageMetadata.writeTo(outStream); singleMessageMetadata.recycle(); outStream.recycle(); } catch (IOException e) { throw new RuntimeException(e); } return batchBuffer.writeBytes(payload); }
public void writeTo(org.apache.pulsar.common.util.protobuf.ByteBufCodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < properties_.size(); i++) { output.writeMessage(1, properties_.get(i)); } if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(2, getPartitionKeyBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(3, payloadSize_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBool(4, compactedOut_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeUInt64(5, eventTime_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBool(6, partitionKeyB64Encoded_); } }
public static ByteBuf serializeSingleMessageInBatchWithPayload( PulsarApi.SingleMessageMetadata.Builder singleMessageMetadataBuilder, ByteBuf payload, ByteBuf batchBuffer) { int payLoadSize = payload.readableBytes(); PulsarApi.SingleMessageMetadata singleMessageMetadata = singleMessageMetadataBuilder.setPayloadSize(payLoadSize) .build(); // serialize meta-data size, meta-data and payload for single message in batch int singleMsgMetadataSize = singleMessageMetadata.getSerializedSize(); try { batchBuffer.writeInt(singleMsgMetadataSize); ByteBufCodedOutputStream outStream = ByteBufCodedOutputStream.get(batchBuffer); singleMessageMetadata.writeTo(outStream); singleMessageMetadata.recycle(); outStream.recycle(); } catch (IOException e) { throw new RuntimeException(e); } return batchBuffer.writeBytes(payload); }
public void writeTo(org.apache.pulsar.common.util.protobuf.ByteBufCodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < properties_.size(); i++) { output.writeMessage(1, properties_.get(i)); } if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(2, getPartitionKeyBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(3, payloadSize_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBool(4, compactedOut_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeUInt64(5, eventTime_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBool(6, partitionKeyB64Encoded_); } }