use of com.yahoo.pulsar.common.api.proto.PulsarApi.CommandAck in project pulsar by yahoo.
the class Commands method newAck.
public static ByteBuf newAck(long consumerId, long ledgerId, long entryId, AckType ackType, ValidationError validationError) {
CommandAck.Builder ackBuilder = CommandAck.newBuilder();
ackBuilder.setConsumerId(consumerId);
ackBuilder.setAckType(ackType);
MessageIdData.Builder messageIdDataBuilder = MessageIdData.newBuilder();
messageIdDataBuilder.setLedgerId(ledgerId);
messageIdDataBuilder.setEntryId(entryId);
MessageIdData messageIdData = messageIdDataBuilder.build();
ackBuilder.setMessageId(messageIdData);
if (validationError != null) {
ackBuilder.setValidationError(validationError);
}
CommandAck ack = ackBuilder.build();
ByteBuf res = serializeWithSize(BaseCommand.newBuilder().setType(Type.ACK).setAck(ack));
ack.recycle();
ackBuilder.recycle();
messageIdDataBuilder.recycle();
messageIdData.recycle();
return res;
}
Aggregations