/** * * * <pre> * This ID can be used to acknowledge the received message. * </pre> * * <code>string ack_id = 1;</code> */ public Builder clearAckId() { ackId_ = getDefaultInstance().getAckId(); onChanged(); return this; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + ACK_ID_FIELD_NUMBER; hash = (53 * hash) + getAckId().hashCode(); if (hasMessage()) { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.pubsub.v1.ReceivedMessage)) { return super.equals(obj); } com.google.pubsub.v1.ReceivedMessage other = (com.google.pubsub.v1.ReceivedMessage) obj; boolean result = true; result = result && getAckId().equals(other.getAckId()); result = result && (hasMessage() == other.hasMessage()); if (hasMessage()) { result = result && getMessage().equals(other.getMessage()); } result = result && unknownFields.equals(other.unknownFields); return result; }
public Builder mergeFrom(com.google.pubsub.v1.ReceivedMessage other) { if (other == com.google.pubsub.v1.ReceivedMessage.getDefaultInstance()) return this; if (!other.getAckId().isEmpty()) { ackId_ = other.ackId_; onChanged(); } if (other.hasMessage()) { mergeMessage(other.getMessage()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test public void testAck() throws Exception { dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE), NOOP_RUNNABLE); consumers.take().ack(); dispatcher.processOutstandingAckOperations(); assertThat(sentAcks).contains(TEST_MESSAGE.getAckId()); }
@Test public void testExtension_Close() throws Exception { dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE), NOOP_RUNNABLE); dispatcher.extendDeadlines(); assertThat(sentModAcks) .contains(ModAckItem.of(TEST_MESSAGE.getAckId(), Subscriber.MIN_ACK_DEADLINE_SECONDS)); sentModAcks.clear(); // Default total expiration is an hour (60*60 seconds). We normally would extend by 10s. // However, only extend by 5s here, since there's only 5s left before total expiration. clock.advance(60 * 60 - 5, TimeUnit.SECONDS); dispatcher.extendDeadlines(); assertThat(sentModAcks).contains(ModAckItem.of(TEST_MESSAGE.getAckId(), 5)); }
@Test public void testExtension() throws Exception { dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE), NOOP_RUNNABLE); dispatcher.extendDeadlines(); assertThat(sentModAcks) .contains(ModAckItem.of(TEST_MESSAGE.getAckId(), Subscriber.MIN_ACK_DEADLINE_SECONDS)); sentModAcks.clear(); consumers.take().ack(); dispatcher.extendDeadlines(); assertThat(sentModAcks).isEmpty(); }
@Test public void testReceipt() throws Exception { dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE), NOOP_RUNNABLE); dispatcher.processOutstandingAckOperations(); assertThat(sentModAcks) .contains(ModAckItem.of(TEST_MESSAGE.getAckId(), Subscriber.MIN_ACK_DEADLINE_SECONDS)); }
@Test public void testNack() throws Exception { dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE), NOOP_RUNNABLE); consumers.take().nack(); dispatcher.processOutstandingAckOperations(); assertThat(sentModAcks).contains(ModAckItem.of(TEST_MESSAGE.getAckId(), 0)); }
@Test public void testExtension_GiveUp() throws Exception { dispatcher.processReceivedMessages(Collections.singletonList(TEST_MESSAGE), NOOP_RUNNABLE); dispatcher.extendDeadlines(); assertThat(sentModAcks) .contains(ModAckItem.of(TEST_MESSAGE.getAckId(), Subscriber.MIN_ACK_DEADLINE_SECONDS)); sentModAcks.clear(); // If we run extendDeadlines after totalExpiration, we shouldn't send anything. // In particular, don't send negative modacks. clock.advance(1, TimeUnit.DAYS); dispatcher.extendDeadlines(); assertThat(sentModAcks).isEmpty(); // We should be able to reserve another item in the flow controller and not block shutdown flowController.reserve(1, 0); dispatcher.stop(); }
ackIds.add(message.getAckId());
/** * <pre> * This ID can be used to acknowledge the received message. * </pre> * * <code>optional string ack_id = 1;</code> */ public Builder clearAckId() { ackId_ = getDefaultInstance().getAckId(); onChanged(); return this; } /**
/** * <code>optional string ack_id = 1;</code> * * <pre> * This ID can be used to acknowledge the received message. * </pre> */ public Builder clearAckId() { ackId_ = getDefaultInstance().getAckId(); onChanged(); return this; } /**
/** * * * <pre> * This ID can be used to acknowledge the received message. * </pre> * * <code>string ack_id = 1;</code> */ public Builder clearAckId() { ackId_ = getDefaultInstance().getAckId(); onChanged(); return this; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + ACK_ID_FIELD_NUMBER; hash = (53 * hash) + getAckId().hashCode(); if (hasMessage()) { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
public Builder mergeFrom(com.google.pubsub.v1.ReceivedMessage other) { if (other == com.google.pubsub.v1.ReceivedMessage.getDefaultInstance()) return this; if (!other.getAckId().isEmpty()) { ackId_ = other.ackId_; onChanged(); } if (other.hasMessage()) { mergeMessage(other.getMessage()); } onChanged(); return this; }
public Builder mergeFrom(com.google.pubsub.v1.ReceivedMessage other) { if (other == com.google.pubsub.v1.ReceivedMessage.getDefaultInstance()) return this; if (!other.getAckId().isEmpty()) { ackId_ = other.ackId_; onChanged(); } if (other.hasMessage()) { mergeMessage(other.getMessage()); } onChanged(); return this; }
public Builder mergeFrom(com.google.pubsub.v1.ReceivedMessage other) { if (other == com.google.pubsub.v1.ReceivedMessage.getDefaultInstance()) return this; if (!other.getAckId().isEmpty()) { ackId_ = other.ackId_; onChanged(); } if (other.hasMessage()) { mergeMessage(other.getMessage()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }