public abstract class PubsubClient
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Class and Description | 
|---|---|
| static class  | PubsubClient.OutgoingMessageA message to be sent to Pubsub. | 
| static class  | PubsubClient.ProjectPathPath representing a cloud project id. | 
| static interface  | PubsubClient.PubsubClientFactoryFactory for creating clients. | 
| static class  | PubsubClient.SchemaPathPath representing a Pubsub schema. | 
| static class  | PubsubClient.SubscriptionPathPath representing a Pubsub subscription. | 
| static class  | PubsubClient.TopicPathPath representing a Pubsub topic. | 
| Constructor and Description | 
|---|
| PubsubClient() | 
| Modifier and Type | Method and Description | 
|---|---|
| abstract int | ackDeadlineSeconds(PubsubClient.SubscriptionPath subscription)Return the ack deadline, in seconds, for  subscription. | 
| abstract void | acknowledge(PubsubClient.SubscriptionPath subscription,
           java.util.List<java.lang.String> ackIds)Acknowldege messages from  subscriptionwithackIds. | 
| PubsubClient.SubscriptionPath | createRandomSubscription(PubsubClient.ProjectPath project,
                        PubsubClient.TopicPath topic,
                        int ackDeadlineSeconds)Create a random subscription for  topic. | 
| abstract void | createSchema(PubsubClient.SchemaPath schemaPath,
            java.lang.String schemaContent,
            com.google.pubsub.v1.Schema.Type type)Create  Schemafrom Schema definition content. | 
| abstract void | createSubscription(PubsubClient.TopicPath topic,
                  PubsubClient.SubscriptionPath subscription,
                  int ackDeadlineSeconds)Create  subscriptiontotopic. | 
| abstract void | createTopic(PubsubClient.TopicPath topic)Create  topic. | 
| abstract void | createTopic(PubsubClient.TopicPath topic,
           PubsubClient.SchemaPath schema)Create {link TopicPath} with  PubsubClient.SchemaPath. | 
| abstract void | deleteSchema(PubsubClient.SchemaPath schemaPath)Delete  PubsubClient.SchemaPath. | 
| abstract void | deleteSubscription(PubsubClient.SubscriptionPath subscription)Delete  subscription. | 
| abstract void | deleteTopic(PubsubClient.TopicPath topic) | 
| protected static long | extractTimestampAttribute(java.lang.String timestampAttribute,
                         @Nullable java.util.Map<java.lang.String,java.lang.String> attributes)Return the timestamp (in ms since unix epoch) to use for a Pubsub message with  timestampAttributeandattriutes. | 
| abstract Schema | getSchema(PubsubClient.SchemaPath schemaPath)Return a Beam  Schemafrom the Pub/Sub schema resource, if exists. | 
| abstract PubsubClient.SchemaPath | getSchemaPath(PubsubClient.TopicPath topicPath)Return  PubsubClient.SchemaPathfromPubsubClient.TopicPathif exists. | 
| abstract boolean | isEOF()Return true if  pull(long, org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.SubscriptionPath, int, boolean)will always return empty list. | 
| abstract java.util.List<PubsubClient.SubscriptionPath> | listSubscriptions(PubsubClient.ProjectPath project,
                 PubsubClient.TopicPath topic)Return a list of subscriptions for  topicinproject. | 
| abstract java.util.List<PubsubClient.TopicPath> | listTopics(PubsubClient.ProjectPath project)Return a list of topics for  project. | 
| abstract void | modifyAckDeadline(PubsubClient.SubscriptionPath subscription,
                 java.util.List<java.lang.String> ackIds,
                 int deadlineSeconds)Modify the ack deadline for messages from  subscriptionwithackIdsto bedeadlineSecondsfrom now. | 
| protected static java.lang.Long | parseTimestampAsMsSinceEpoch(java.lang.String timestamp)Return timestamp as ms-since-unix-epoch corresponding to  timestamp. | 
| static PubsubClient.ProjectPath | projectPathFromId(java.lang.String projectId) | 
| static PubsubClient.ProjectPath | projectPathFromPath(java.lang.String path) | 
| abstract int | publish(PubsubClient.TopicPath topic,
       java.util.List<PubsubClient.OutgoingMessage> outgoingMessages)Publish  outgoingMessagesto Pubsubtopic. | 
| abstract java.util.List<org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.IncomingMessage> | pull(long requestTimeMsSinceEpoch,
    PubsubClient.SubscriptionPath subscription,
    int batchSize,
    boolean returnImmediately)Request the next batch of up to  batchSizemessages fromsubscription. | 
| static PubsubClient.SchemaPath | schemaPathFromId(java.lang.String projectId,
                java.lang.String schemaId) | 
| static PubsubClient.SchemaPath | schemaPathFromPath(java.lang.String path) | 
| static PubsubClient.SubscriptionPath | subscriptionPathFromName(java.lang.String projectId,
                        java.lang.String subscriptionName) | 
| static PubsubClient.SubscriptionPath | subscriptionPathFromPath(java.lang.String path) | 
| static PubsubClient.TopicPath | topicPathFromName(java.lang.String projectId,
                 java.lang.String topicName) | 
| static PubsubClient.TopicPath | topicPathFromPath(java.lang.String path) | 
protected static java.lang.Long parseTimestampAsMsSinceEpoch(java.lang.String timestamp)
timestamp. Throw IllegalArgumentException if timestamp cannot be recognized.protected static long extractTimestampAttribute(java.lang.String timestampAttribute,
                                                @Nullable java.util.Map<java.lang.String,java.lang.String> attributes)
timestampAttribute and attriutes.
 The message attributes must contain timestampAttribute, and the value of that
 attribute will be taken as the timestamp.
java.lang.IllegalArgumentException - if the timestamp cannot be recognized as a ms-since-unix-epoch
     or RFC3339 time.public static PubsubClient.ProjectPath projectPathFromPath(java.lang.String path)
public static PubsubClient.ProjectPath projectPathFromId(java.lang.String projectId)
public static PubsubClient.SchemaPath schemaPathFromPath(java.lang.String path)
public static PubsubClient.SchemaPath schemaPathFromId(java.lang.String projectId, java.lang.String schemaId)
public static PubsubClient.SubscriptionPath subscriptionPathFromPath(java.lang.String path)
public static PubsubClient.SubscriptionPath subscriptionPathFromName(java.lang.String projectId, java.lang.String subscriptionName)
public static PubsubClient.TopicPath topicPathFromPath(java.lang.String path)
public static PubsubClient.TopicPath topicPathFromName(java.lang.String projectId, java.lang.String topicName)
public abstract int publish(PubsubClient.TopicPath topic, java.util.List<PubsubClient.OutgoingMessage> outgoingMessages) throws java.io.IOException
outgoingMessages to Pubsub topic. Return number of messages published.java.io.IOExceptionpublic abstract java.util.List<org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.IncomingMessage> pull(long requestTimeMsSinceEpoch,
                                                                                                    PubsubClient.SubscriptionPath subscription,
                                                                                                    int batchSize,
                                                                                                    boolean returnImmediately)
                                                                                             throws java.io.IOException
batchSize messages from subscription. Return
 the received messages, or empty collection if none were available. Does not wait for messages
 to arrive if returnImmediately is true. Returned messages will record their
 request time as requestTimeMsSinceEpoch.java.io.IOExceptionpublic abstract void acknowledge(PubsubClient.SubscriptionPath subscription, java.util.List<java.lang.String> ackIds) throws java.io.IOException
subscription with ackIds.java.io.IOExceptionpublic abstract void modifyAckDeadline(PubsubClient.SubscriptionPath subscription, java.util.List<java.lang.String> ackIds, int deadlineSeconds) throws java.io.IOException
subscription with ackIds to be deadlineSeconds from now.java.io.IOExceptionpublic abstract void createTopic(PubsubClient.TopicPath topic) throws java.io.IOException
topic.java.io.IOExceptionpublic abstract void createTopic(PubsubClient.TopicPath topic, PubsubClient.SchemaPath schema) throws java.io.IOException
PubsubClient.SchemaPath.java.io.IOExceptionpublic abstract void deleteTopic(PubsubClient.TopicPath topic) throws java.io.IOException
java.io.IOExceptionpublic abstract java.util.List<PubsubClient.TopicPath> listTopics(PubsubClient.ProjectPath project) throws java.io.IOException
project.java.io.IOExceptionpublic abstract void createSubscription(PubsubClient.TopicPath topic, PubsubClient.SubscriptionPath subscription, int ackDeadlineSeconds) throws java.io.IOException
subscription to topic.java.io.IOExceptionpublic PubsubClient.SubscriptionPath createRandomSubscription(PubsubClient.ProjectPath project, PubsubClient.TopicPath topic, int ackDeadlineSeconds) throws java.io.IOException
topic. Return the PubsubClient.SubscriptionPath. It is the
 responsibility of the caller to later delete the subscription.java.io.IOExceptionpublic abstract void deleteSubscription(PubsubClient.SubscriptionPath subscription) throws java.io.IOException
subscription.java.io.IOExceptionpublic abstract java.util.List<PubsubClient.SubscriptionPath> listSubscriptions(PubsubClient.ProjectPath project, PubsubClient.TopicPath topic) throws java.io.IOException
topic in project.java.io.IOExceptionpublic abstract int ackDeadlineSeconds(PubsubClient.SubscriptionPath subscription) throws java.io.IOException
subscription.java.io.IOExceptionpublic abstract boolean isEOF()
pull(long, org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.SubscriptionPath, int, boolean) will always return empty list. Actual clients will
 return false. Test clients may return true to signal that all expected
 messages have been pulled and the test may complete.public abstract void createSchema(PubsubClient.SchemaPath schemaPath, java.lang.String schemaContent, com.google.pubsub.v1.Schema.Type type) throws java.io.IOException
Schema from Schema definition content.java.io.IOExceptionpublic abstract void deleteSchema(PubsubClient.SchemaPath schemaPath) throws java.io.IOException
PubsubClient.SchemaPath.java.io.IOExceptionpublic abstract PubsubClient.SchemaPath getSchemaPath(PubsubClient.TopicPath topicPath) throws java.io.IOException
PubsubClient.SchemaPath from PubsubClient.TopicPath if exists.java.io.IOExceptionpublic abstract Schema getSchema(PubsubClient.SchemaPath schemaPath) throws java.io.IOException
Schema from the Pub/Sub schema resource, if exists.java.io.IOException