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 Builder mergeFrom(org.apache.pulsar.common.api.proto.PulsarApi.SingleMessageMetadata other) { if (other == org.apache.pulsar.common.api.proto.PulsarApi.SingleMessageMetadata.getDefaultInstance()) return this; if (!other.properties_.isEmpty()) { if (properties_.isEmpty()) { properties_ = other.properties_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensurePropertiesIsMutable(); properties_.addAll(other.properties_); } } if (other.hasPartitionKey()) { setPartitionKey(other.getPartitionKey()); } if (other.hasPayloadSize()) { setPayloadSize(other.getPayloadSize()); } if (other.hasCompactedOut()) { setCompactedOut(other.getCompactedOut()); } if (other.hasEventTime()) { setEventTime(other.getEventTime()); } if (other.hasPartitionKeyB64Encoded()) { setPartitionKeyB64Encoded(other.getPartitionKeyB64Encoded()); } return this; }
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 Builder mergeFrom(org.apache.pulsar.common.api.proto.PulsarApi.SingleMessageMetadata other) { if (other == org.apache.pulsar.common.api.proto.PulsarApi.SingleMessageMetadata.getDefaultInstance()) return this; if (!other.properties_.isEmpty()) { if (properties_.isEmpty()) { properties_ = other.properties_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensurePropertiesIsMutable(); properties_.addAll(other.properties_); } } if (other.hasPartitionKey()) { setPartitionKey(other.getPartitionKey()); } if (other.hasPayloadSize()) { setPayloadSize(other.getPayloadSize()); } if (other.hasCompactedOut()) { setCompactedOut(other.getCompactedOut()); } if (other.hasEventTime()) { setEventTime(other.getEventTime()); } if (other.hasPartitionKeyB64Encoded()) { setPartitionKeyB64Encoded(other.getPartitionKeyB64Encoded()); } return this; }