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