builder.setEntryId(startMessageId.getEntryId()); if (startMessageId instanceof BatchMessageIdImpl) { builder.setBatchIndex(((BatchMessageIdImpl) startMessageId).getBatchIndex());
protected byte[] toByteArray(int batchIndex) { MessageIdData.Builder builder = MessageIdData.newBuilder(); builder.setLedgerId(ledgerId); builder.setEntryId(entryId); if (partitionIndex >= 0) { builder.setPartition(partitionIndex); } if (batchIndex != -1) { builder.setBatchIndex(batchIndex); } MessageIdData msgId = builder.build(); int size = msgId.getSerializedSize(); ByteBuf serialized = Unpooled.buffer(size, size); ByteBufCodedOutputStream stream = ByteBufCodedOutputStream.get(serialized); try { msgId.writeTo(stream); } catch (IOException e) { // This is in-memory serialization, should not fail throw new RuntimeException(e); } msgId.recycle(); builder.recycle(); stream.recycle(); return serialized.array(); }
builder.setEntryId(startMessageId.getEntryId()); if (startMessageId instanceof BatchMessageIdImpl) { builder.setBatchIndex(((BatchMessageIdImpl) startMessageId).getBatchIndex());
protected byte[] toByteArray(int batchIndex) { MessageIdData.Builder builder = MessageIdData.newBuilder(); builder.setLedgerId(ledgerId); builder.setEntryId(entryId); if (partitionIndex >= 0) { builder.setPartition(partitionIndex); } if (batchIndex != -1) { builder.setBatchIndex(batchIndex); } MessageIdData msgId = builder.build(); int size = msgId.getSerializedSize(); ByteBuf serialized = Unpooled.buffer(size, size); ByteBufCodedOutputStream stream = ByteBufCodedOutputStream.get(serialized); try { msgId.writeTo(stream); } catch (IOException e) { // This is in-memory serialization, should not fail throw new RuntimeException(e); } msgId.recycle(); builder.recycle(); stream.recycle(); return serialized.array(); }
public Builder mergeFrom(org.apache.pulsar.common.api.proto.PulsarApi.MessageIdData other) { if (other == org.apache.pulsar.common.api.proto.PulsarApi.MessageIdData.getDefaultInstance()) return this; if (other.hasLedgerId()) { setLedgerId(other.getLedgerId()); } if (other.hasEntryId()) { setEntryId(other.getEntryId()); } if (other.hasPartition()) { setPartition(other.getPartition()); } if (other.hasBatchIndex()) { setBatchIndex(other.getBatchIndex()); } return this; }
public Builder mergeFrom(org.apache.pulsar.common.api.proto.PulsarApi.MessageIdData other) { if (other == org.apache.pulsar.common.api.proto.PulsarApi.MessageIdData.getDefaultInstance()) return this; if (other.hasLedgerId()) { setLedgerId(other.getLedgerId()); } if (other.hasEntryId()) { setEntryId(other.getEntryId()); } if (other.hasPartition()) { setPartition(other.getPartition()); } if (other.hasBatchIndex()) { setBatchIndex(other.getBatchIndex()); } return this; }