use of org.apache.pulsar.common.api.proto.CommandMessage in project pulsar by apache.
the class Commands method newMessageCommand.
public static BaseCommand newMessageCommand(long consumerId, long ledgerId, long entryId, int partition, int redeliveryCount, long[] ackSet, long consumerEpoch) {
BaseCommand cmd = localCmd(Type.MESSAGE);
CommandMessage msg = cmd.setMessage().setConsumerId(consumerId);
msg.setMessageId().setLedgerId(ledgerId).setEntryId(entryId).setPartition(partition);
// consumerEpoch > -1 is useful
if (consumerEpoch > DEFAULT_CONSUMER_EPOCH) {
msg.setConsumerEpoch(consumerEpoch);
}
if (redeliveryCount > 0) {
msg.setRedeliveryCount(redeliveryCount);
}
if (ackSet != null) {
for (int i = 0; i < ackSet.length; i++) {
msg.addAckSet(ackSet[i]);
}
}
return cmd;
}
Aggregations