Search in sources :

Example 1 with CommandMessage

use of org.apache.pulsar.common.api.proto.PulsarApi.CommandMessage in project incubator-pulsar by apache.

the class Commands method newMessage.

public static ByteBufPair 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();
    ByteBufPair res = serializeCommandMessageWithSize(cmd, metadataAndPayload);
    cmd.recycle();
    cmdBuilder.recycle();
    msg.recycle();
    msgBuilder.recycle();
    return res;
}
Also used : BaseCommand(org.apache.pulsar.common.api.proto.PulsarApi.BaseCommand) CommandMessage(org.apache.pulsar.common.api.proto.PulsarApi.CommandMessage)

Aggregations

BaseCommand (org.apache.pulsar.common.api.proto.PulsarApi.BaseCommand)1 CommandMessage (org.apache.pulsar.common.api.proto.PulsarApi.CommandMessage)1