@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.pubsub.v1.Subscription)) { return super.equals(obj); } com.google.pubsub.v1.Subscription other = (com.google.pubsub.v1.Subscription) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && getTopic().equals(other.getTopic()); result = result && (hasPushConfig() == other.hasPushConfig()); if (hasPushConfig()) { result = result && getPushConfig().equals(other.getPushConfig()); } result = result && (getAckDeadlineSeconds() == other.getAckDeadlineSeconds()); result = result && (getRetainAckedMessages() == other.getRetainAckedMessages()); result = result && (hasMessageRetentionDuration() == other.hasMessageRetentionDuration()); if (hasMessageRetentionDuration()) { result = result && getMessageRetentionDuration().equals(other.getMessageRetentionDuration()); } result = result && internalGetLabels().equals(other.internalGetLabels()); result = result && (hasExpirationPolicy() == other.hasExpirationPolicy()); if (hasExpirationPolicy()) { result = result && getExpirationPolicy().equals(other.getExpirationPolicy()); } result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
/** * * * <pre> * The name of the topic from which this subscription is receiving messages. * Format is `projects/{project}/topics/{topic}`. * The value of this field will be `_deleted-topic_` if the topic has been * deleted. * </pre> * * <code>string topic = 2;</code> */ public Builder clearTopic() { topic_ = getDefaultInstance().getTopic(); onChanged(); return this; } /**
/** * * * <pre> * The name of the subscription. It must have the format * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must * start with a letter, and contain only letters (`[A-Za-z]`), numbers * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters * in length, and it must not start with `"goog"`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); 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.Subscription)) { return super.equals(obj); } com.google.pubsub.v1.Subscription other = (com.google.pubsub.v1.Subscription) obj; boolean result = true; result = result && getName() .equals(other.getName()); result = result && getTopic() .equals(other.getTopic()); result = result && (hasPushConfig() == other.hasPushConfig()); if (hasPushConfig()) { result = result && getPushConfig() .equals(other.getPushConfig()); } result = result && (getAckDeadlineSeconds() == other.getAckDeadlineSeconds()); return result; }
boolean retainAckedMessages = false; Subscription expectedResponse = Subscription.newBuilder() .setName(name2.toString()) .setTopic(topic2.toString()) Subscription actualRequest = (Subscription) actualRequests.get(0); Assert.assertEquals(name, ProjectSubscriptionName.parse(actualRequest.getName())); Assert.assertEquals(Objects.toString(topic), actualRequest.getTopic()); Assert.assertEquals(pushConfig, actualRequest.getPushConfig()); Assert.assertEquals(ackDeadlineSeconds, actualRequest.getAckDeadlineSeconds()); Assert.assertTrue( channelProvider.isHeaderSent(
@java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (!getTopicBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, topic_); } if (pushConfig_ != null) { output.writeMessage(4, getPushConfig()); } if (ackDeadlineSeconds_ != 0) { output.writeInt32(5, ackDeadlineSeconds_); } if (retainAckedMessages_ != false) { output.writeBool(7, retainAckedMessages_); } if (messageRetentionDuration_ != null) { output.writeMessage(8, getMessageRetentionDuration()); } com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 9); if (expirationPolicy_ != null) { output.writeMessage(11, getExpirationPolicy()); } unknownFields.writeTo(output); }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (!getTopicBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, topic_); } if (pushConfig_ != null) { output.writeMessage(4, getPushConfig()); } if (ackDeadlineSeconds_ != 0) { output.writeInt32(5, ackDeadlineSeconds_); } }
@java.lang.Override public com.google.pubsub.v1.Subscription getDefaultInstanceForType() { return com.google.pubsub.v1.Subscription.getDefaultInstance(); }
@Override public List<SubscriptionPath> listSubscriptions(ProjectPath project, TopicPath topic) throws IOException { ListSubscriptionsRequest.Builder request = ListSubscriptionsRequest.newBuilder() .setProject(project.getPath()) .setPageSize(LIST_BATCH_SIZE); ListSubscriptionsResponse response = subscriberStub().listSubscriptions(request.build()); if (response.getSubscriptionsCount() == 0) { return ImmutableList.of(); } List<SubscriptionPath> subscriptions = new ArrayList<>(response.getSubscriptionsCount()); while (true) { for (Subscription subscription : response.getSubscriptionsList()) { if (subscription.getTopic().equals(topic.getPath())) { subscriptions.add(subscriptionPathFromPath(subscription.getName())); } } if (response.getNextPageToken().isEmpty()) { break; } request.setPageToken(response.getNextPageToken()); response = subscriberStub().listSubscriptions(request.build()); } return subscriptions; }
/** * * * <pre> * If push delivery is used with this subscription, this field is * used to configure it. An empty `pushConfig` signifies that the subscriber * will pull and ack messages using API methods. * </pre> * * <code>.google.pubsub.v1.PushConfig push_config = 4;</code> */ public com.google.pubsub.v1.PushConfigOrBuilder getPushConfigOrBuilder() { return getPushConfig(); }
@java.lang.Override public com.google.pubsub.v1.Subscription buildPartial() { com.google.pubsub.v1.Subscription result = new com.google.pubsub.v1.Subscription(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; result.name_ = name_; result.topic_ = topic_; if (pushConfigBuilder_ == null) { result.pushConfig_ = pushConfig_; } else { result.pushConfig_ = pushConfigBuilder_.build(); } result.ackDeadlineSeconds_ = ackDeadlineSeconds_; result.retainAckedMessages_ = retainAckedMessages_; if (messageRetentionDurationBuilder_ == null) { result.messageRetentionDuration_ = messageRetentionDuration_; } else { result.messageRetentionDuration_ = messageRetentionDurationBuilder_.build(); } result.labels_ = internalGetLabels(); result.labels_.makeImmutable(); if (expirationPolicyBuilder_ == null) { result.expirationPolicy_ = expirationPolicy_; } else { result.expirationPolicy_ = expirationPolicyBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; }
@Override public int ackDeadlineSeconds(SubscriptionPath subscription) throws IOException { GetSubscriptionRequest request = GetSubscriptionRequest.newBuilder().setSubscription(subscription.getPath()).build(); Subscription response = subscriberStub().getSubscription(request); return response.getAckDeadlineSeconds(); }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptorForType().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (37 * hash) + TOPIC_FIELD_NUMBER; hash = (53 * hash) + getTopic().hashCode(); if (hasPushConfig()) { hash = (37 * hash) + PUSH_CONFIG_FIELD_NUMBER; hash = (53 * hash) + getPushConfig().hashCode(); } hash = (37 * hash) + ACK_DEADLINE_SECONDS_FIELD_NUMBER; hash = (53 * hash) + getAckDeadlineSeconds(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
if (!getNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); if (!getTopicBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, topic_); size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getPushConfig()); size += com.google.protobuf.CodedOutputStream.computeMessageSize( 8, getMessageRetentionDuration()); internalGetLabels().getMap().entrySet()) { com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ = LabelsDefaultEntryHolder.defaultEntry size += com.google.protobuf.CodedOutputStream.computeMessageSize(11, getExpirationPolicy());
public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (!getTopicBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, topic_); } if (pushConfig_ != null) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, getPushConfig()); } if (ackDeadlineSeconds_ != 0) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(5, ackDeadlineSeconds_); } memoizedSize = size; return size; }
/** * * * <pre> * The updated subscription object. * </pre> * * <code>.google.pubsub.v1.Subscription subscription = 1;</code> */ public com.google.pubsub.v1.Subscription getSubscription() { return subscription_ == null ? com.google.pubsub.v1.Subscription.getDefaultInstance() : subscription_; } /**
/** * <pre> * The name of the subscription. It must have the format * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must * start with a letter, and contain only letters (`[A-Za-z]`), numbers * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters * in length, and it must not start with `"goog"`. * </pre> * * <code>optional string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**