@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.pubsub.v1.PullRequest)) { return super.equals(obj); } com.google.pubsub.v1.PullRequest other = (com.google.pubsub.v1.PullRequest) obj; boolean result = true; result = result && getSubscription().equals(other.getSubscription()); result = result && (getReturnImmediately() == other.getReturnImmediately()); result = result && (getMaxMessages() == other.getMaxMessages()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + SUBSCRIPTION_FIELD_NUMBER; hash = (53 * hash) + getSubscription().hashCode(); hash = (37 * hash) + RETURN_IMMEDIATELY_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getReturnImmediately()); hash = (37 * hash) + MAX_MESSAGES_FIELD_NUMBER; hash = (53 * hash) + getMaxMessages(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * The subscription from which messages should be pulled. * Format is `projects/{project}/subscriptions/{sub}`. * </pre> * * <code>string subscription = 1;</code> */ public Builder clearSubscription() { subscription_ = getDefaultInstance().getSubscription(); onChanged(); return this; } /**
public Builder mergeFrom(com.google.pubsub.v1.PullRequest other) { if (other == com.google.pubsub.v1.PullRequest.getDefaultInstance()) return this; if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; onChanged(); } if (other.getReturnImmediately() != false) { setReturnImmediately(other.getReturnImmediately()); } if (other.getMaxMessages() != 0) { setMaxMessages(other.getMaxMessages()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void pullTest() { PullResponse expectedResponse = PullResponse.newBuilder().build(); mockSubscriber.addResponse(expectedResponse); ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]"); boolean returnImmediately = false; int maxMessages = 496131527; PullResponse actualResponse = client.pull(subscription, returnImmediately, maxMessages); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); PullRequest actualRequest = (PullRequest) actualRequests.get(0); Assert.assertEquals( subscription, ProjectSubscriptionName.parse(actualRequest.getSubscription())); Assert.assertEquals(returnImmediately, actualRequest.getReturnImmediately()); Assert.assertEquals(maxMessages, actualRequest.getMaxMessages()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
/** * <pre> * The subscription from which messages should be pulled. * </pre> * * <code>optional string subscription = 1;</code> */ public Builder clearSubscription() { subscription_ = getDefaultInstance().getSubscription(); onChanged(); return this; } /**
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.pubsub.v1.PullRequest)) { return super.equals(obj); } com.google.pubsub.v1.PullRequest other = (com.google.pubsub.v1.PullRequest) obj; boolean result = true; result = result && getSubscription().equals(other.getSubscription()); result = result && (getReturnImmediately() == other.getReturnImmediately()); result = result && (getMaxMessages() == other.getMaxMessages()); result = result && unknownFields.equals(other.unknownFields); return result; }
/** * <code>optional string subscription = 1;</code> * * <pre> * The subscription from which messages should be pulled. * </pre> */ public Builder clearSubscription() { subscription_ = getDefaultInstance().getSubscription(); onChanged(); return this; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); hash = (37 * hash) + SUBSCRIPTION_FIELD_NUMBER; hash = (53 * hash) + getSubscription().hashCode(); hash = (37 * hash) + RETURN_IMMEDIATELY_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( getReturnImmediately()); hash = (37 * hash) + MAX_MESSAGES_FIELD_NUMBER; hash = (53 * hash) + getMaxMessages(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + SUBSCRIPTION_FIELD_NUMBER; hash = (53 * hash) + getSubscription().hashCode(); hash = (37 * hash) + RETURN_IMMEDIATELY_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getReturnImmediately()); hash = (37 * hash) + MAX_MESSAGES_FIELD_NUMBER; hash = (53 * hash) + getMaxMessages(); 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.PullRequest)) { return super.equals(obj); } com.google.pubsub.v1.PullRequest other = (com.google.pubsub.v1.PullRequest) obj; boolean result = true; result = result && getSubscription() .equals(other.getSubscription()); result = result && (getReturnImmediately() == other.getReturnImmediately()); result = result && (getMaxMessages() == other.getMaxMessages()); return result; }
/** * * * <pre> * The subscription from which messages should be pulled. * Format is `projects/{project}/subscriptions/{sub}`. * </pre> * * <code>string subscription = 1;</code> */ public Builder clearSubscription() { subscription_ = getDefaultInstance().getSubscription(); onChanged(); return this; } /**
/** * Pulls messages synchronously, on demand, using the pull request in argument. * * @param pullRequest pull request containing the subscription name * @return the list of {@link AcknowledgeablePubsubMessage} containing the ack ID, subscription * and acknowledger */ private List<AcknowledgeablePubsubMessage> pull(PullRequest pullRequest) { Assert.notNull(pullRequest, "The pull request can't be null."); PullResponse pullResponse = this.subscriberStub.pullCallable().call(pullRequest); return pullResponse.getReceivedMessagesList().stream() .map((message) -> new PulledAcknowledgeablePubsubMessage( ProjectSubscriptionName.of( this.subscriberFactory.getProjectId(), pullRequest.getSubscription()), message.getMessage(), message.getAckId())) .collect(Collectors.toList()); }
/** * Pulls messages synchronously, on demand, using the pull request in argument. * * @param pullRequest pull request containing the subscription name * @return the list of {@link AcknowledgeablePubsubMessage} containing the ack ID, subscription * and acknowledger */ private List<AcknowledgeablePubsubMessage> pull(PullRequest pullRequest) { Assert.notNull(pullRequest, "The pull request can't be null."); PullResponse pullResponse = this.subscriberStub.pullCallable().call(pullRequest); return pullResponse.getReceivedMessagesList().stream() .map((message) -> new PulledAcknowledgeablePubsubMessage( ProjectSubscriptionName.of( this.subscriberFactory.getProjectId(), pullRequest.getSubscription()), message.getMessage(), message.getAckId())) .collect(Collectors.toList()); }
public Builder mergeFrom(com.google.pubsub.v1.PullRequest other) { if (other == com.google.pubsub.v1.PullRequest.getDefaultInstance()) return this; if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; onChanged(); } if (other.getReturnImmediately() != false) { setReturnImmediately(other.getReturnImmediately()); } if (other.getMaxMessages() != 0) { setMaxMessages(other.getMaxMessages()); } onChanged(); return this; }
public Builder mergeFrom(com.google.pubsub.v1.PullRequest other) { if (other == com.google.pubsub.v1.PullRequest.getDefaultInstance()) return this; if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; onChanged(); } if (other.getReturnImmediately() != false) { setReturnImmediately(other.getReturnImmediately()); } if (other.getMaxMessages() != 0) { setMaxMessages(other.getMaxMessages()); } onChanged(); return this; }
public Builder mergeFrom(com.google.pubsub.v1.PullRequest other) { if (other == com.google.pubsub.v1.PullRequest.getDefaultInstance()) return this; if (!other.getSubscription().isEmpty()) { subscription_ = other.subscription_; onChanged(); } if (other.getReturnImmediately() != false) { setReturnImmediately(other.getReturnImmediately()); } if (other.getMaxMessages() != 0) { setMaxMessages(other.getMaxMessages()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }