public class SubscriptionInfo extends Object implements Serializable
In a push subscription, the Pub/Sub server sends a request to the subscriber application, at a
preconfigured endpoint (see PushConfig). The subscriber's HTTP response serves as an
implicit acknowledgement: a success response indicates that the message has been succesfully
processed and the Pub/Sub system can delete it from the subscription; a non-success response
indicates that the Pub/Sub server should resend it (implicit "nack").
In a pull subscription, the subscribing application must explicitly pull messages using one of
PubSub.pull(String, int), PubSub.pullAsync(String, int) or
PubSub.pullAsync(String, PubSub.MessageProcessor callback, PubSub.PullOption...).
When messages are pulled with PubSub.pull(String, int) or
PubSub.pullAsync(String, int) the subscribing application must also explicitly
acknowledge them using one of PubSub.ack(String, Iterable),
PubSub.ack(String, String, String...), PubSub.ackAsync(String, Iterable) or
PubSub.ackAsync(String, String, String...).
| Modifier and Type | Class and Description |
|---|---|
static class |
SubscriptionInfo.Builder
Builder for
SubscriptionInfo objects. |
| Modifier and Type | Method and Description |
|---|---|
long |
ackDeadlineSeconds()
Returns the maximum time after a subscriber receives a message before the subscriber should
acknowledge the message.
|
static SubscriptionInfo.Builder |
builder(String topic,
String name)
Creates a builder for
SubscriptionInfo objects given the name of the topic and the name
of the subscription. |
static SubscriptionInfo.Builder |
builder(TopicId topic,
String name)
Creates a builder for
SubscriptionInfo objects given the identity of the topic and the
name of the subscription. |
boolean |
equals(Object obj) |
int |
hashCode() |
String |
name()
Returns the name of the subscription.
|
static SubscriptionInfo |
of(String topic,
String name)
Creates a pull
SubscriptionInfo object given the name of the topic and the name of the
subscription. |
static SubscriptionInfo |
of(String topic,
String name,
String endpoint)
Creates a push
SubscriptionInfo object given the name of the topic, the name of the
subscription and the push endpoint. |
static SubscriptionInfo |
of(TopicId topic,
String name)
Creates a pull
SubscriptionInfo object given the identity of the topic and the name of
the subscription. |
static SubscriptionInfo |
of(TopicId topic,
String name,
String endpoint)
Creates a push
SubscriptionInfo object given the identity of the topic, the name of the
subscription and the push endpoint. |
PushConfig |
pushConfig()
Returns the push configuration for the subscription.
|
SubscriptionInfo.Builder |
toBuilder()
Returns a builder for the subscription object.
|
TopicId |
topic()
Returns the identity of the topic this subscription refers to.
|
String |
toString() |
public TopicId topic()
TopicId.project() is
null the topic is assumed to reside in the ServiceOptions.projectId() project.
After a topic is deleted, existing subscriptions to that topic are not deleted, but their topic
field is set to TopicId.deletedTopic().public String name()
[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 cannot begin with the
string goog.public PushConfig pushConfig()
null, the subscription is in pull
mode.public long ackDeadlineSeconds()
PubSub.modifyAckDeadline(String, int, TimeUnit, Iterable). For push
delivery, this value is used to set the request timeout for the call to the push endpoint. This
value must be between 10 and 600 seconds, if not specified, 10 seconds is used.public SubscriptionInfo.Builder toBuilder()
public static SubscriptionInfo of(String topic, String name)
SubscriptionInfo object given the name of the topic and the name of the
subscription. The topic is assumed to reside in the ServiceOptions.projectId() project.topic - the name of the topic the subscription refers toname - the name of the subscription. The name 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 cannot begin with the
string goog.public static SubscriptionInfo of(TopicId topic, String name)
SubscriptionInfo object given the identity of the topic and the name of
the subscription. If topic.project() is null the topic is assumed to reside in
the ServiceOptions.projectId() project.topic - the identity of the topic the subscription refers toname - the name of the subscription. The name 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 cannot begin with the
string goog.public static SubscriptionInfo of(String topic, String name, String endpoint)
SubscriptionInfo object given the name of the topic, the name of the
subscription and the push endpoint. The topic is assumed to reside in the
ServiceOptions.projectId() project.topic - the name of the topic the subscription refers toname - the name of the subscription. The name 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 cannot begin with the
string goog.endpoint - a URL locating the endpoint to which messages should be pushed. For example,
an endpoint might use https://example.com/push.public static SubscriptionInfo of(TopicId topic, String name, String endpoint)
SubscriptionInfo object given the identity of the topic, the name of the
subscription and the push endpoint. If topic.project() is null the topic is
assumed to reside in the ServiceOptions.projectId() project.topic - the identity of the topic the subscription refers toname - the name of the subscription. The name 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 cannot begin with the
string goog.endpoint - a URL locating the endpoint to which messages should be pushed. For example,
an endpoint might use https://example.com/push.public static SubscriptionInfo.Builder builder(String topic, String name)
SubscriptionInfo objects given the name of the topic and the name
of the subscription. The topic is assumed to reside in the ServiceOptions.projectId()
project.topic - the name of the topic the subscription refers toname - the name of the subscription. The name 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 cannot begin with the
string goog.public static SubscriptionInfo.Builder builder(TopicId topic, String name)
SubscriptionInfo objects given the identity of the topic and the
name of the subscription. If topic.project() is null the topic is assumed to
reside in the ServiceOptions.projectId() project.topic - the identity of the topic the subscription refers toname - the name of the subscription. The name 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 cannot begin with the
string goog.Copyright © 2016 Google. All rights reserved.