use of com.yahoo.pulsar.common.api.proto.PulsarApi.MessageIdData in project pulsar by yahoo.
the class Consumer method messageAcked.
void messageAcked(CommandAck ack) {
MessageIdData msgId = ack.getMessageId();
PositionImpl position = PositionImpl.get(msgId.getLedgerId(), msgId.getEntryId());
if (ack.hasValidationError()) {
log.error("[{}] [{}] Received ack for corrupted message at {} - Reason: {}", subscription, consumerId, position, ack.getValidationError());
}
if (subType == SubType.Shared) {
// On shared subscriptions, cumulative ack is not supported
checkArgument(ack.getAckType() == AckType.Individual);
// Only ack a single message
removePendingAcks(position);
subscription.acknowledgeMessage(position, AckType.Individual);
} else {
subscription.acknowledgeMessage(position, ack.getAckType());
}
}
use of com.yahoo.pulsar.common.api.proto.PulsarApi.MessageIdData in project pulsar by yahoo.
the class Commands method newSendReceipt.
public static ByteBuf newSendReceipt(long producerId, long sequenceId, long ledgerId, long entryId) {
CommandSendReceipt.Builder sendReceiptBuilder = CommandSendReceipt.newBuilder();
sendReceiptBuilder.setProducerId(producerId);
sendReceiptBuilder.setSequenceId(sequenceId);
MessageIdData.Builder messageIdBuilder = MessageIdData.newBuilder();
messageIdBuilder.setLedgerId(ledgerId);
messageIdBuilder.setEntryId(entryId);
MessageIdData messageId = messageIdBuilder.build();
sendReceiptBuilder.setMessageId(messageId);
CommandSendReceipt sendReceipt = sendReceiptBuilder.build();
ByteBuf res = serializeWithSize(BaseCommand.newBuilder().setType(Type.SEND_RECEIPT).setSendReceipt(sendReceipt));
messageIdBuilder.recycle();
messageId.recycle();
sendReceiptBuilder.recycle();
sendReceipt.recycle();
return res;
}
Aggregations