Search in sources :

Example 1 with CommandAck

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;
}
Also used : CommandAck(com.yahoo.pulsar.common.api.proto.PulsarApi.CommandAck) MessageIdData(com.yahoo.pulsar.common.api.proto.PulsarApi.MessageIdData) UnpooledHeapByteBuf(io.netty.buffer.UnpooledHeapByteBuf) RecyclableDuplicateByteBuf(io.netty.buffer.RecyclableDuplicateByteBuf) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

CommandAck (com.yahoo.pulsar.common.api.proto.PulsarApi.CommandAck)1 MessageIdData (com.yahoo.pulsar.common.api.proto.PulsarApi.MessageIdData)1 ByteBuf (io.netty.buffer.ByteBuf)1 RecyclableDuplicateByteBuf (io.netty.buffer.RecyclableDuplicateByteBuf)1 UnpooledHeapByteBuf (io.netty.buffer.UnpooledHeapByteBuf)1