google-cloud-pubsublite overview (1.6.3)

com.google.cloud.pubsublite

com.google.cloud.pubsublite.cloudpubsub

com.google.cloud.pubsublite.cloudpubsub.internal

com.google.cloud.pubsublite.internal

com.google.cloud.pubsublite.internal.testing

com.google.cloud.pubsublite.internal.wire

com.google.cloud.pubsublite.proto

com.google.cloud.pubsublite.v1

The interfaces provided are listed below, along with usage samples.

AdminServiceClient

Service Description: The service that a client application uses to manage topics and subscriptions, such creating, listing, and deleting topics and subscriptions.

Sample for AdminServiceClient:

   
 // This snippet has been automatically generated for illustrative purposes only. 
  
 // It may require modifications to work in your environment. 
  
 try 
  
 ( 
 AdminServiceClient 
  
 adminServiceClient 
  
 = 
  
 AdminServiceClient 
 . 
 create 
 ()) 
  
 { 
  
 LocationName 
  
 parent 
  
 = 
  
 LocationName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[LOCATION]" 
 ); 
  
 Topic 
  
 topic 
  
 = 
  
 Topic 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 String 
  
 topicId 
  
 = 
  
 "topicId-1139259734" 
 ; 
  
 Topic 
  
 response 
  
 = 
  
 adminServiceClient 
 . 
 createTopic 
 ( 
 parent 
 , 
  
 topic 
 , 
  
 topicId 
 ); 
  
 } 
  
 

CursorServiceClient

Service Description: The service that a subscriber client application uses to manage committed cursors while receiving messsages. A cursor represents a subscriber's progress within a topic partition for a given subscription.

Sample for CursorServiceClient:

   
 // This snippet has been automatically generated for illustrative purposes only. 
  
 // It may require modifications to work in your environment. 
  
 try 
  
 ( 
 CursorServiceClient 
  
 cursorServiceClient 
  
 = 
  
 CursorServiceClient 
 . 
 create 
 ()) 
  
 { 
  
 CommitCursorRequest 
  
 request 
  
 = 
  
 CommitCursorRequest 
 . 
 newBuilder 
 () 
  
 . 
 setSubscription 
 ( 
 "subscription341203229" 
 ) 
  
 . 
 setPartition 
 ( 
 - 
 1799810326 
 ) 
  
 . 
 setCursor 
 ( 
 Cursor 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 build 
 (); 
  
 CommitCursorResponse 
  
 response 
  
 = 
  
 cursorServiceClient 
 . 
 commitCursor 
 ( 
 request 
 ); 
  
 } 
  
 

PublisherServiceClient

Service Description: The service that a publisher client application uses to publish messages to topics. Published messages are retained by the service for the duration of the retention period configured for the respective topic, and are delivered to subscriber clients upon request (via the SubscriberService ).

Sample for PublisherServiceClient:

   
 // This snippet has been automatically generated for illustrative purposes only. 
  
 // It may require modifications to work in your environment. 
  
 try 
  
 ( 
 PublisherServiceClient 
  
 publisherServiceClient 
  
 = 
  
 PublisherServiceClient 
 . 
 create 
 ()) 
  
 { 
  
 BidiStream<PublishRequest 
 , 
  
 PublishResponse 
>  
 bidiStream 
  
 = 
  
 publisherServiceClient 
 . 
 publishCallable 
 (). 
 call 
 (); 
  
 PublishRequest 
  
 request 
  
 = 
  
 PublishRequest 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 bidiStream 
 . 
 send 
 ( 
 request 
 ); 
  
 for 
  
 ( 
 PublishResponse 
  
 response 
  
 : 
  
 bidiStream 
 ) 
  
 { 
  
 // Do something when a response is received. 
  
 } 
  
 } 
  
 

SubscriberServiceClient

Service Description: The service that a subscriber client application uses to receive messages from subscriptions.

Sample for SubscriberServiceClient:

   
 // This snippet has been automatically generated for illustrative purposes only. 
  
 // It may require modifications to work in your environment. 
  
 try 
  
 ( 
 SubscriberServiceClient 
  
 subscriberServiceClient 
  
 = 
  
 SubscriberServiceClient 
 . 
 create 
 ()) 
  
 { 
  
 BidiStream<SubscribeRequest 
 , 
  
 SubscribeResponse 
>  
 bidiStream 
  
 = 
  
 subscriberServiceClient 
 . 
 subscribeCallable 
 (). 
 call 
 (); 
  
 SubscribeRequest 
  
 request 
  
 = 
  
 SubscribeRequest 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 bidiStream 
 . 
 send 
 ( 
 request 
 ); 
  
 for 
  
 ( 
 SubscribeResponse 
  
 response 
  
 : 
  
 bidiStream 
 ) 
  
 { 
  
 // Do something when a response is received. 
  
 } 
  
 } 
  
 

PartitionAssignmentServiceClient

Service Description: The service that a subscriber client application uses to determine which partitions it should connect to.

Sample for PartitionAssignmentServiceClient:

   
 // This snippet has been automatically generated for illustrative purposes only. 
  
 // It may require modifications to work in your environment. 
  
 try 
  
 ( 
 PartitionAssignmentServiceClient 
  
 partitionAssignmentServiceClient 
  
 = 
  
 PartitionAssignmentServiceClient 
 . 
 create 
 ()) 
  
 { 
  
 BidiStream<PartitionAssignmentRequest 
 , 
  
 PartitionAssignment 
>  
 bidiStream 
  
 = 
  
 partitionAssignmentServiceClient 
 . 
 assignPartitionsCallable 
 (). 
 call 
 (); 
  
 PartitionAssignmentRequest 
  
 request 
  
 = 
  
 PartitionAssignmentRequest 
 . 
 newBuilder 
 (). 
 build 
 (); 
  
 bidiStream 
 . 
 send 
 ( 
 request 
 ); 
  
 for 
  
 ( 
 PartitionAssignment 
  
 response 
  
 : 
  
 bidiStream 
 ) 
  
 { 
  
 // Do something when a response is received. 
  
 } 
  
 } 
  
 

TopicStatsServiceClient

Service Description: This service allows users to get stats about messages in their topic.

Sample for TopicStatsServiceClient:

   
 // This snippet has been automatically generated for illustrative purposes only. 
  
 // It may require modifications to work in your environment. 
  
 try 
  
 ( 
 TopicStatsServiceClient 
  
 topicStatsServiceClient 
  
 = 
  
 TopicStatsServiceClient 
 . 
 create 
 ()) 
  
 { 
  
 ComputeMessageStatsRequest 
  
 request 
  
 = 
  
 ComputeMessageStatsRequest 
 . 
 newBuilder 
 () 
  
 . 
 setTopic 
 ( 
 TopicName 
 . 
 of 
 ( 
 "[PROJECT]" 
 , 
  
 "[LOCATION]" 
 , 
  
 "[TOPIC]" 
 ). 
 toString 
 ()) 
  
 . 
 setPartition 
 ( 
 - 
 1799810326 
 ) 
  
 . 
 setStartCursor 
 ( 
 Cursor 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 setEndCursor 
 ( 
 Cursor 
 . 
 newBuilder 
 (). 
 build 
 ()) 
  
 . 
 build 
 (); 
  
 ComputeMessageStatsResponse 
  
 response 
  
 = 
  
 topicStatsServiceClient 
 . 
 computeMessageStats 
 ( 
 request 
 ); 
  
 } 
  
 

com.google.cloud.pubsublite.v1.stub

Design a Mobile Site
View Site in Mobile | Classic
Share by: