Search in sources :

Example 1 with CommandMessage

use of com.yahoo.pulsar.common.api.proto.PulsarApi.CommandMessage in project pulsar by yahoo.

the class Commands method newMessage.

public static ByteBuf newMessage(long consumerId, MessageIdData messageId, ByteBuf metadataAndPayload) {
    CommandMessage.Builder msgBuilder = CommandMessage.newBuilder();
    msgBuilder.setConsumerId(consumerId);
    msgBuilder.setMessageId(messageId);
    CommandMessage msg = msgBuilder.build();
    BaseCommand.Builder cmdBuilder = BaseCommand.newBuilder();
    BaseCommand cmd = cmdBuilder.setType(Type.MESSAGE).setMessage(msg).build();
    ByteBuf res = serializeCommandMessageWithSize(cmd, metadataAndPayload);
    cmd.recycle();
    cmdBuilder.recycle();
    msg.recycle();
    msgBuilder.recycle();
    return res;
}
Also used : BaseCommand(com.yahoo.pulsar.common.api.proto.PulsarApi.BaseCommand) UnpooledHeapByteBuf(io.netty.buffer.UnpooledHeapByteBuf) RecyclableDuplicateByteBuf(io.netty.buffer.RecyclableDuplicateByteBuf) ByteBuf(io.netty.buffer.ByteBuf) CommandMessage(com.yahoo.pulsar.common.api.proto.PulsarApi.CommandMessage)

Aggregations

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