public class Pubsub extends Object implements Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
Pubsub.Builder
A
Pubsub.Builder that can be used to build a new Pubsub client. |
| Modifier and Type | Method and Description |
|---|---|
PubsubFuture<Void> |
acknowledge(String canonicalSubscriptionName,
List<String> ackIds)
Acknowledge a batch of received messages.
|
PubsubFuture<Void> |
acknowledge(String project,
String subscription,
List<String> ackIds)
Acknowledge a batch of received messages.
|
PubsubFuture<Void> |
acknowledge(String project,
String subscription,
String... ackIds)
Acknowledge a batch of received messages.
|
static Pubsub.Builder |
builder()
Create a new
Pubsub.Builder that can be used to build a new Pubsub client. |
void |
close()
Close this
Pubsub client. |
CompletableFuture<Void> |
closeFuture()
Get a future that is completed when this
Pubsub client is closed. |
static Pubsub |
create()
Create a new
Pubsub client with default configuration. |
PubsubFuture<Subscription> |
createSubscription(String canonicalSubscriptionName,
String canonicalTopic)
Create a Pub/Sub subscription.
|
PubsubFuture<Subscription> |
createSubscription(String project,
String subscriptionName,
String topic)
Create a Pub/Sub subscription.
|
PubsubFuture<Topic> |
createTopic(String project,
String topic)
Create a Pub/Sub topic.
|
PubsubFuture<Void> |
deleteSubscription(String canonicalSubscriptionName)
Delete a Pub/Sub subscription.
|
PubsubFuture<Void> |
deleteSubscription(String project,
String subscription)
Delete a Pub/Sub subscription.
|
PubsubFuture<Void> |
deleteTopic(String canonicalTopic)
Delete a Pub/Sub topic.
|
PubsubFuture<Void> |
deleteTopic(String project,
String topic)
Delete a Pub/Sub topic.
|
PubsubFuture<Subscription> |
getSubscription(String canonicalSubscriptionName)
Get a Pub/Sub subscription.
|
PubsubFuture<Subscription> |
getSubscription(String project,
String subscription)
Get a Pub/Sub subscription.
|
PubsubFuture<Topic> |
getTopic(String canonicalTopic)
Get a Pub/Sub topic.
|
PubsubFuture<Topic> |
getTopic(String project,
String topic)
Get a Pub/Sub topic.
|
PubsubFuture<SubscriptionList> |
listSubscriptions(String project)
List the Pub/Sub subscriptions in a project.
|
PubsubFuture<SubscriptionList> |
listSubscriptions(String project,
String pageToken)
Get a page of Pub/Sub subscriptions in a project using a specified page token.
|
PubsubFuture<TopicList> |
listTopics(String project)
List the Pub/Sub topics in a project.
|
PubsubFuture<TopicList> |
listTopics(String project,
String pageToken)
Get a page of Pub/Sub topics in a project using a specified page token.
|
PubsubFuture<Void> |
modifyAckDeadline(String canonicalSubscriptionName,
int ackDeadlineSeconds,
List<String> ackIds)
Modify the ack deadline for a list of received messages.
|
PubsubFuture<Void> |
modifyAckDeadline(String project,
String subscription,
int ackDeadlineSeconds,
List<String> ackIds)
Modify the ack deadline for a list of received messages.
|
PubsubFuture<Void> |
modifyAckDeadline(String project,
String subscription,
int ackDeadlineSeconds,
String... ackIds)
Modify the ack deadline for a list of received messages.
|
PubsubFuture<List<String>> |
publish(List<Message> messages,
String canonicalTopic)
Publish a batch of messages.
|
PubsubFuture<List<String>> |
publish(String project,
String topic,
List<Message> messages)
Publish a batch of messages.
|
PubsubFuture<List<String>> |
publish(String project,
String topic,
Message... messages)
Publish a batch of messages.
|
PubsubFuture<List<ReceivedMessage>> |
pull(String canonicalSubscriptionName)
Pull a batch of messages.
|
PubsubFuture<List<ReceivedMessage>> |
pull(String canonicalSubscriptionName,
boolean returnImmediately)
Pull a batch of messages.
|
PubsubFuture<List<ReceivedMessage>> |
pull(String canonicalSubscriptionName,
boolean returnImmediately,
int maxMessages)
Pull a batch of messages.
|
PubsubFuture<List<ReceivedMessage>> |
pull(String path,
com.spotify.google.cloud.pubsub.client.PullRequest pullRequest)
Pull a batch of messages.
|
PubsubFuture<List<ReceivedMessage>> |
pull(String project,
String subscription)
Pull a batch of messages.
|
PubsubFuture<List<ReceivedMessage>> |
pull(String project,
String subscription,
boolean returnImmediately)
Pull a batch of messages.
|
PubsubFuture<List<ReceivedMessage>> |
pull(String project,
String subscription,
boolean returnImmediately,
int maxMessages)
Pull a batch of messages.
|
public void close()
Pubsub client.close in interface Closeableclose in interface AutoCloseablepublic CompletableFuture<Void> closeFuture()
Pubsub client is closed.public PubsubFuture<TopicList> listTopics(String project)
listTopics(String, String) with the page token in order to get further
pages.project - The Google Cloud project.public PubsubFuture<TopicList> listTopics(String project, String pageToken)
project - The Google Cloud project.pageToken - A token for the page of topics to get.public PubsubFuture<Topic> createTopic(String project, String topic)
project - The Google Cloud project.topic - The name of the topic to create.public PubsubFuture<Topic> getTopic(String project, String topic)
project - The Google Cloud project.topic - The name of the topic to get.null
if the response is 404.public PubsubFuture<Topic> getTopic(String canonicalTopic)
canonicalTopic - The canonical (including project) name of the topic to get.null
if the response is 404.public PubsubFuture<Void> deleteTopic(String project, String topic)
project - The Google Cloud project.topic - The name of the topic to delete.null
if the response is 404.public PubsubFuture<Void> deleteTopic(String canonicalTopic)
canonicalTopic - The canonical (including project) name of the topic to delete.null
if the response is 404.public PubsubFuture<Subscription> createSubscription(String project, String subscriptionName, String topic)
project - The Google Cloud project.subscriptionName - The name of the subscription to create.topic - The name of the topic to subscribe to.public PubsubFuture<SubscriptionList> listSubscriptions(String project)
listTopics(String, String) with the page token in
order to get further pages.project - The Google Cloud project.public PubsubFuture<SubscriptionList> listSubscriptions(String project, String pageToken)
project - The Google Cloud project.pageToken - A token for the page of subscriptions to get.public PubsubFuture<Subscription> createSubscription(String canonicalSubscriptionName, String canonicalTopic)
canonicalSubscriptionName - The canonical (including project) name of the scubscription to create.canonicalTopic - The canonical (including project) name of the topic to subscribe to.public PubsubFuture<Subscription> getSubscription(String project, String subscription)
project - The Google Cloud project.subscription - The name of the subscription to get.null
if the response is 404.public PubsubFuture<Subscription> getSubscription(String canonicalSubscriptionName)
canonicalSubscriptionName - The canonical (including project) name of the subscription to get.null
if the response is 404.public PubsubFuture<Void> deleteSubscription(String project, String subscription)
project - The Google Cloud project.subscription - The name of the subscription to delete.null
if the response is 404.public PubsubFuture<Void> deleteSubscription(String canonicalSubscriptionName)
canonicalSubscriptionName - The canonical (including project) name of the subscription to delete.null
if the response is 404.public PubsubFuture<List<String>> publish(String project, String topic, Message... messages)
project - The Google Cloud project.topic - The topic to publish on.messages - The batch of messages.public PubsubFuture<List<String>> publish(String project, String topic, List<Message> messages)
project - The Google Cloud project.topic - The topic to publish on.messages - The batch of messages.public PubsubFuture<List<String>> publish(List<Message> messages, String canonicalTopic)
messages - The batch of messages.canonicalTopic - The canonical topic to publish on.public PubsubFuture<List<ReceivedMessage>> pull(String project, String subscription)
project - The Google Cloud project.subscription - The subscription to pull from.public PubsubFuture<List<ReceivedMessage>> pull(String project, String subscription, boolean returnImmediately)
project - The Google Cloud project.subscription - The subscription to pull from.returnImmediately - true to return immediately if the queue is empty. false to wait for at
least one message before returning.public PubsubFuture<List<ReceivedMessage>> pull(String project, String subscription, boolean returnImmediately, int maxMessages)
project - The Google Cloud project.subscription - The subscription to pull from.returnImmediately - true to return immediately if the queue is empty. false to wait for at
least one message before returning.maxMessages - Maximum number of messages to return in batch.public PubsubFuture<List<ReceivedMessage>> pull(String canonicalSubscriptionName)
canonicalSubscriptionName - The canonical (including project name) subscription to pull from.public PubsubFuture<List<ReceivedMessage>> pull(String canonicalSubscriptionName, boolean returnImmediately)
canonicalSubscriptionName - The canonical (including project name) subscription to pull from.returnImmediately - true to return immediately if the queue is empty. false to wait
for at least one message before returning.public PubsubFuture<List<ReceivedMessage>> pull(String canonicalSubscriptionName, boolean returnImmediately, int maxMessages)
canonicalSubscriptionName - The canonical (including project name) subscription to pull from.returnImmediately - true to return immediately if the queue is empty. false to wait
for at least one message before returning.maxMessages - Maximum number of messages to return in batch.public PubsubFuture<List<ReceivedMessage>> pull(String path, com.spotify.google.cloud.pubsub.client.PullRequest pullRequest)
pullRequest - The pull request.public PubsubFuture<Void> acknowledge(String project, String subscription, String... ackIds)
project - The Google Cloud project.subscription - The subscription to acknowledge messages on.ackIds - List of message ID's to acknowledge.public PubsubFuture<Void> acknowledge(String project, String subscription, List<String> ackIds)
project - The Google Cloud project.subscription - The subscription to acknowledge messages on.ackIds - List of message ID's to acknowledge.public PubsubFuture<Void> acknowledge(String canonicalSubscriptionName, List<String> ackIds)
canonicalSubscriptionName - The canonical (including project name) subscription to acknowledge messages on.ackIds - List of message ID's to acknowledge.public PubsubFuture<Void> modifyAckDeadline(String project, String subscription, int ackDeadlineSeconds, String... ackIds)
project - The Google Cloud project.subscription - The subscription of the received message to modify the ack deadline on.ackDeadlineSeconds - The new ack deadline.ackIds - List of message ID's to modify the ack deadline on.public PubsubFuture<Void> modifyAckDeadline(String project, String subscription, int ackDeadlineSeconds, List<String> ackIds)
project - The Google Cloud project.subscription - The subscription of the received message to modify the ack deadline on.ackDeadlineSeconds - The new ack deadline.ackIds - List of message ID's to modify the ack deadline on.public PubsubFuture<Void> modifyAckDeadline(String canonicalSubscriptionName, int ackDeadlineSeconds, List<String> ackIds)
canonicalSubscriptionName - The canonical (including project name) subscription of the received message to
modify the ack deadline on.ackDeadlineSeconds - The new ack deadline.ackIds - List of message ID's to modify the ack deadline on.public static Pubsub.Builder builder()
Pubsub.Builder that can be used to build a new Pubsub client.Copyright © 2018. All rights reserved.