@Override protected CompletableFuture<Void> doAcknowledge(MessageId messageId, AckType ackType, Map<String,Long> properties) { checkArgument(messageId instanceof MessageIdImpl); if (getState() != State.Ready && getState() != State.Connecting) { stats.incrementNumAcksFailed(); PulsarClientException exception = new PulsarClientException("Consumer not ready. State: " + getState()); if (AckType.Individual.equals(ackType)) { onAcknowledge(messageId, exception); } else if (AckType.Cumulative.equals(ackType)) { onAcknowledgeCumulative(messageId, exception); } return FutureUtil.failedFuture(exception); } if (messageId instanceof BatchMessageIdImpl) { if (markAckForBatchMessage((BatchMessageIdImpl) messageId, ackType, properties)) { // all messages in batch have been acked so broker can be acked via sendAcknowledge() if (log.isDebugEnabled()) { log.debug("[{}] [{}] acknowledging message - {}, acktype {}", subscription, consumerName, messageId, ackType); } } else { // other messages in batch are still pending ack. return CompletableFuture.completedFuture(null); } } return sendAcknowledge(messageId, ackType, properties); }
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream .computeUInt64Size(1, consumerId_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream .computeEnumSize(2, ackType_.getNumber()); } for (int i = 0; i < messageId_.size(); i++) { size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream .computeMessageSize(3, messageId_.get(i)); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream .computeEnumSize(4, validationError_.getNumber()); } for (int i = 0; i < properties_.size(); i++) { size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream .computeMessageSize(5, properties_.get(i)); } memoizedSerializedSize = size; return size; }
org.apache.pulsar.common.api.proto.PulsarApi.CommandAck.AckType value = org.apache.pulsar.common.api.proto.PulsarApi.CommandAck.AckType.valueOf(rawValue); if (value != null) { bitField0_ |= 0x00000002;
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream .computeUInt64Size(1, consumerId_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream .computeEnumSize(2, ackType_.getNumber()); } for (int i = 0; i < messageId_.size(); i++) { size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream .computeMessageSize(3, messageId_.get(i)); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream .computeEnumSize(4, validationError_.getNumber()); } for (int i = 0; i < properties_.size(); i++) { size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream .computeMessageSize(5, properties_.get(i)); } memoizedSerializedSize = size; return size; }
@Override protected CompletableFuture<Void> doAcknowledge(MessageId messageId, AckType ackType, Map<String,Long> properties) { checkArgument(messageId instanceof MessageIdImpl); if (getState() != State.Ready && getState() != State.Connecting) { stats.incrementNumAcksFailed(); PulsarClientException exception = new PulsarClientException("Consumer not ready. State: " + getState()); if (AckType.Individual.equals(ackType)) { onAcknowledge(messageId, exception); } else if (AckType.Cumulative.equals(ackType)) { onAcknowledgeCumulative(messageId, exception); } return FutureUtil.failedFuture(exception); } if (messageId instanceof BatchMessageIdImpl) { if (markAckForBatchMessage((BatchMessageIdImpl) messageId, ackType, properties)) { // all messages in batch have been acked so broker can be acked via sendAcknowledge() if (log.isDebugEnabled()) { log.debug("[{}] [{}] acknowledging message - {}, acktype {}", subscription, consumerName, messageId, ackType); } } else { // other messages in batch are still pending ack. return CompletableFuture.completedFuture(null); } } return sendAcknowledge(messageId, ackType, properties); }
public void writeTo(org.apache.pulsar.common.util.protobuf.ByteBufCodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeUInt64(1, consumerId_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeEnum(2, ackType_.getNumber()); } for (int i = 0; i < messageId_.size(); i++) { output.writeMessage(3, messageId_.get(i)); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeEnum(4, validationError_.getNumber()); } for (int i = 0; i < properties_.size(); i++) { output.writeMessage(5, properties_.get(i)); } }
org.apache.pulsar.common.api.proto.PulsarApi.CommandAck.AckType value = org.apache.pulsar.common.api.proto.PulsarApi.CommandAck.AckType.valueOf(rawValue); if (value != null) { bitField0_ |= 0x00000002;
public void writeTo(org.apache.pulsar.common.util.protobuf.ByteBufCodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeUInt64(1, consumerId_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeEnum(2, ackType_.getNumber()); } for (int i = 0; i < messageId_.size(); i++) { output.writeMessage(3, messageId_.get(i)); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeEnum(4, validationError_.getNumber()); } for (int i = 0; i < properties_.size(); i++) { output.writeMessage(5, properties_.get(i)); } }