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;
}
Aggregations