├── .cloudbuild └── samples_build.yaml ├── .github ├── .OwlBot-hermetic.yaml ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── support_request.md ├── PULL_REQUEST_TEMPLATE.md ├── auto-label.yaml ├── blunderbuss.yml ├── dependabot.yml ├── generated-files-bot.yml ├── release-please.yml ├── release-trigger.yml ├── scripts │ └── update_generation_config.sh ├── snippet-bot.yml ├── sync-repo-settings.yaml ├── trusted-contribution.yml └── workflows │ ├── approve-readme.yaml │ ├── auto-release.yaml │ ├── ci.yaml │ ├── hermetic_library_generation.yaml │ ├── renovate_config_check.yaml │ ├── samples.yaml │ ├── unmanaged_dependency_check.yaml │ └── update_generation_config.yaml ├── .gitignore ├── .kokoro ├── build.bat ├── build.sh ├── coerce_logs.sh ├── common.cfg ├── common.sh ├── continuous │ ├── common.cfg │ ├── java8.cfg │ └── samples.cfg ├── dependencies.sh ├── nightly │ ├── common.cfg │ ├── integration.cfg │ ├── java11-integration.cfg │ ├── java11.cfg │ ├── java7.cfg │ ├── java8-osx.cfg │ ├── java8-win.cfg │ ├── java8.cfg │ └── samples.cfg ├── populate-secrets.sh ├── presubmit │ ├── clirr.cfg │ ├── common.cfg │ ├── dependencies.cfg │ ├── graalvm-native-17.cfg │ ├── graalvm-native-a.cfg │ ├── graalvm-native-b.cfg │ ├── graalvm-native-c.cfg │ ├── graalvm-native.cfg │ ├── integration.cfg │ ├── java11.cfg │ ├── java7.cfg │ ├── java8-osx.cfg │ ├── java8-win.cfg │ ├── java8.cfg │ ├── linkage-monitor.cfg │ ├── lint.cfg │ └── samples.cfg ├── readme.sh └── trampoline.sh ├── .readme-partials.yaml ├── .repo-metadata.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── codecov.yaml ├── generation_config.yaml ├── google-cloud-pubsublite-bom └── pom.xml ├── google-cloud-pubsublite ├── EnableAutoValue.txt ├── clirr-ignored-differences.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── google │ │ │ └── cloud │ │ │ └── pubsublite │ │ │ ├── AdminClient.java │ │ │ ├── AdminClientSettings.java │ │ │ ├── BacklogLocation.java │ │ │ ├── CloudRegion.java │ │ │ ├── CloudRegionOrZone.java │ │ │ ├── CloudZone.java │ │ │ ├── Constants.java │ │ │ ├── Endpoints.java │ │ │ ├── ErrorCodes.java │ │ │ ├── LocationPath.java │ │ │ ├── Message.java │ │ │ ├── MessageMetadata.java │ │ │ ├── MessageTransformer.java │ │ │ ├── Offset.java │ │ │ ├── Partition.java │ │ │ ├── PartitionLookupUtils.java │ │ │ ├── ProjectBuilderHelper.java │ │ │ ├── ProjectId.java │ │ │ ├── ProjectIdOrNumber.java │ │ │ ├── ProjectLocationBuilderHelper.java │ │ │ ├── ProjectNumber.java │ │ │ ├── ProjectPath.java │ │ │ ├── ReservationName.java │ │ │ ├── ReservationPath.java │ │ │ ├── SeekTarget.java │ │ │ ├── SequencedMessage.java │ │ │ ├── SubscriptionName.java │ │ │ ├── SubscriptionPath.java │ │ │ ├── TopicName.java │ │ │ ├── TopicPath.java │ │ │ ├── cloudpubsub │ │ │ ├── FlowControlSettings.java │ │ │ ├── KeyExtractor.java │ │ │ ├── MessageTransforms.java │ │ │ ├── NackHandler.java │ │ │ ├── PartitionSubscriberClientSupplier.java │ │ │ ├── Publisher.java │ │ │ ├── PublisherSettings.java │ │ │ ├── ReassignmentHandler.java │ │ │ ├── Subscriber.java │ │ │ ├── SubscriberSettings.java │ │ │ └── internal │ │ │ │ ├── AckSetTracker.java │ │ │ │ ├── AckSetTrackerImpl.java │ │ │ │ ├── AssigningSubscriber.java │ │ │ │ ├── MultiPartitionSubscriber.java │ │ │ │ ├── PartitionSubscriberFactory.java │ │ │ │ ├── ResettableSubscriberFactory.java │ │ │ │ ├── SinglePartitionSubscriber.java │ │ │ │ └── WrappingPublisher.java │ │ │ ├── internal │ │ │ ├── AdminClientImpl.java │ │ │ ├── AlarmFactory.java │ │ │ ├── ApiBackgroundResource.java │ │ │ ├── ApiResourceAggregation.java │ │ │ ├── BlockingPullSubscriber.java │ │ │ ├── BlockingPullSubscriberImpl.java │ │ │ ├── BufferingPullSubscriber.java │ │ │ ├── CheckedApiException.java │ │ │ ├── CheckedApiPreconditions.java │ │ │ ├── CloseableMonitor.java │ │ │ ├── CursorClient.java │ │ │ ├── CursorClientImpl.java │ │ │ ├── CursorClientSettings.java │ │ │ ├── DefaultRoutingPolicy.java │ │ │ ├── ExtractStatus.java │ │ │ ├── Lazy.java │ │ │ ├── MoreApiFutures.java │ │ │ ├── ProxyService.java │ │ │ ├── PublishSequenceNumber.java │ │ │ ├── Publisher.java │ │ │ ├── PullSubscriber.java │ │ │ ├── RoutingPolicy.java │ │ │ ├── SequencedPublisher.java │ │ │ ├── SerialExecutor.java │ │ │ ├── TopicStatsClient.java │ │ │ ├── TopicStatsClientImpl.java │ │ │ ├── TopicStatsClientSettings.java │ │ │ ├── UncheckedApiPreconditions.java │ │ │ ├── package-info.java │ │ │ ├── testing │ │ │ │ ├── FakeApiService.java │ │ │ │ ├── TestResetSignal.java │ │ │ │ └── UnitTestExamples.java │ │ │ └── wire │ │ │ │ ├── ApiExceptionCommitter.java │ │ │ │ ├── ApiExceptionPublisher.java │ │ │ │ ├── ApiServiceUtils.java │ │ │ │ ├── Assigner.java │ │ │ │ ├── AssignerFactory.java │ │ │ │ ├── AssignerImpl.java │ │ │ │ ├── AssignerSettings.java │ │ │ │ ├── BatchPublisher.java │ │ │ │ ├── BatchPublisherFactory.java │ │ │ │ ├── BatchPublisherImpl.java │ │ │ │ ├── BatchingCommitter.java │ │ │ │ ├── CommitState.java │ │ │ │ ├── Committer.java │ │ │ │ ├── CommitterImpl.java │ │ │ │ ├── CommitterSettings.java │ │ │ │ ├── ConnectedAssigner.java │ │ │ │ ├── ConnectedAssignerFactory.java │ │ │ │ ├── ConnectedAssignerImpl.java │ │ │ │ ├── ConnectedCommitter.java │ │ │ │ ├── ConnectedCommitterFactory.java │ │ │ │ ├── ConnectedCommitterImpl.java │ │ │ │ ├── ConnectedSubscriber.java │ │ │ │ ├── ConnectedSubscriberFactory.java │ │ │ │ ├── ConnectedSubscriberImpl.java │ │ │ │ ├── FlowControlBatcher.java │ │ │ │ ├── NextOffsetTracker.java │ │ │ │ ├── PartitionAssignmentReceiver.java │ │ │ │ ├── PartitionCountWatcher.java │ │ │ │ ├── PartitionCountWatcherImpl.java │ │ │ │ ├── PartitionCountWatchingPublisher.java │ │ │ │ ├── PartitionCountWatchingPublisherSettings.java │ │ │ │ ├── PartitionPublisherFactory.java │ │ │ │ ├── Predicates.java │ │ │ │ ├── PublisherBuilder.java │ │ │ │ ├── PublisherImpl.java │ │ │ │ ├── PubsubContext.java │ │ │ │ ├── ResetSignal.java │ │ │ │ ├── RetryingConnection.java │ │ │ │ ├── RetryingConnectionImpl.java │ │ │ │ ├── RetryingConnectionObserver.java │ │ │ │ ├── RoutingMetadata.java │ │ │ │ ├── RoutingPublisher.java │ │ │ │ ├── RoutingPublisherBuilder.java │ │ │ │ ├── SequenceAssigningPublisher.java │ │ │ │ ├── SerialBatcher.java │ │ │ │ ├── ServiceClients.java │ │ │ │ ├── SingleConnection.java │ │ │ │ ├── SingleConnectionFactory.java │ │ │ │ ├── SinglePartitionPublisher.java │ │ │ │ ├── SinglePartitionPublisherBuilder.java │ │ │ │ ├── StreamFactories.java │ │ │ │ ├── StreamFactory.java │ │ │ │ ├── StreamIdleTimer.java │ │ │ │ ├── Subscriber.java │ │ │ │ ├── SubscriberBuilder.java │ │ │ │ ├── SubscriberFactory.java │ │ │ │ ├── SubscriberImpl.java │ │ │ │ ├── SubscriberResetHandler.java │ │ │ │ ├── SystemExecutors.java │ │ │ │ ├── TokenCounter.java │ │ │ │ ├── UuidBuilder.java │ │ │ │ ├── Versions.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── v1 │ │ │ ├── AdminServiceClient.java │ │ │ ├── AdminServiceSettings.java │ │ │ ├── CursorServiceClient.java │ │ │ ├── CursorServiceSettings.java │ │ │ ├── PartitionAssignmentServiceClient.java │ │ │ ├── PartitionAssignmentServiceSettings.java │ │ │ ├── PublisherServiceClient.java │ │ │ ├── PublisherServiceSettings.java │ │ │ ├── SubscriberServiceClient.java │ │ │ ├── SubscriberServiceSettings.java │ │ │ ├── TopicStatsServiceClient.java │ │ │ ├── TopicStatsServiceSettings.java │ │ │ ├── gapic_metadata.json │ │ │ ├── package-info.java │ │ │ └── stub │ │ │ ├── AdminServiceStub.java │ │ │ ├── AdminServiceStubSettings.java │ │ │ ├── CursorServiceStub.java │ │ │ ├── CursorServiceStubSettings.java │ │ │ ├── GrpcAdminServiceCallableFactory.java │ │ │ ├── GrpcAdminServiceStub.java │ │ │ ├── GrpcCursorServiceCallableFactory.java │ │ │ ├── GrpcCursorServiceStub.java │ │ │ ├── GrpcPartitionAssignmentServiceCallableFactory.java │ │ │ ├── GrpcPartitionAssignmentServiceStub.java │ │ │ ├── GrpcPublisherServiceCallableFactory.java │ │ │ ├── GrpcPublisherServiceStub.java │ │ │ ├── GrpcSubscriberServiceCallableFactory.java │ │ │ ├── GrpcSubscriberServiceStub.java │ │ │ ├── GrpcTopicStatsServiceCallableFactory.java │ │ │ ├── GrpcTopicStatsServiceStub.java │ │ │ ├── PartitionAssignmentServiceStub.java │ │ │ ├── PartitionAssignmentServiceStubSettings.java │ │ │ ├── PublisherServiceStub.java │ │ │ ├── PublisherServiceStubSettings.java │ │ │ ├── SubscriberServiceStub.java │ │ │ ├── SubscriberServiceStubSettings.java │ │ │ ├── TopicStatsServiceStub.java │ │ │ └── TopicStatsServiceStubSettings.java │ └── resources │ │ └── META-INF │ │ └── native-image │ │ └── com.google.cloud.pubsublite.v1 │ │ └── reflect-config.json │ └── test │ ├── java │ └── com │ │ └── google │ │ └── cloud │ │ └── pubsublite │ │ ├── MessageMetadataTest.java │ │ ├── cloudpubsub │ │ ├── MessageTransformsTest.java │ │ ├── PublisherSettingsTest.java │ │ ├── SubscriberSettingsTest.java │ │ └── internal │ │ │ ├── AckSetTrackerImplTest.java │ │ │ ├── AssigningSubscriberTest.java │ │ │ ├── SinglePartitionSubscriberTest.java │ │ │ └── WrappingPublisherTest.java │ │ ├── internal │ │ ├── AdminClientImplTest.java │ │ ├── ApiExceptionMatcher.java │ │ ├── BlockingPullSubscriberImplTest.java │ │ ├── BufferingPullSubscriberTest.java │ │ ├── CloseableMonitorTest.java │ │ ├── CursorClientImplTest.java │ │ ├── CursorClientSettingsTest.java │ │ ├── DefaultRoutingPolicyTest.java │ │ ├── SerialExecutorTest.java │ │ ├── TopicStatsClientImplTest.java │ │ ├── TopicStatsClientSettingsTest.java │ │ ├── testing │ │ │ └── RetryingConnectionHelpers.java │ │ └── wire │ │ │ ├── AssignerImplTest.java │ │ │ ├── AssignerSettingsTest.java │ │ │ ├── BatchPublisherImplTest.java │ │ │ ├── BatchingCommitterTest.java │ │ │ ├── CommitStateTest.java │ │ │ ├── CommitterImplTest.java │ │ │ ├── CommitterSettingsTest.java │ │ │ ├── ConnectedAssignerImplTest.java │ │ │ ├── ConnectedCommitterImplTest.java │ │ │ ├── ConnectedSubscriberImplTest.java │ │ │ ├── FlowControlBatcherTest.java │ │ │ ├── PartitionCountWatcherImplTest.java │ │ │ ├── PartitionCountWatchingPublisherTest.java │ │ │ ├── PublisherBuilderTest.java │ │ │ ├── PublisherImplTest.java │ │ │ ├── PubsubContextTest.java │ │ │ ├── ResetSignalTest.java │ │ │ ├── RoutingPublisherTest.java │ │ │ ├── SequenceAssigningPublisherTest.java │ │ │ ├── SerialBatcherTest.java │ │ │ ├── SinglePartitionPublisherTest.java │ │ │ ├── StreamIdleTimerTest.java │ │ │ ├── SubscriberBuilderTest.java │ │ │ ├── SubscriberImplTest.java │ │ │ └── VersionsTest.java │ │ ├── it │ │ └── ITVPCNegativeTest.java │ │ └── v1 │ │ ├── AdminServiceClientTest.java │ │ ├── CursorServiceClientTest.java │ │ ├── MockAdminService.java │ │ ├── MockAdminServiceImpl.java │ │ ├── MockCursorService.java │ │ ├── MockCursorServiceImpl.java │ │ ├── MockPartitionAssignmentService.java │ │ ├── MockPartitionAssignmentServiceImpl.java │ │ ├── MockPublisherService.java │ │ ├── MockPublisherServiceImpl.java │ │ ├── MockSubscriberService.java │ │ ├── MockSubscriberServiceImpl.java │ │ ├── MockTopicStatsService.java │ │ ├── MockTopicStatsServiceImpl.java │ │ ├── PartitionAssignmentServiceClientTest.java │ │ ├── PublisherServiceClientTest.java │ │ ├── SubscriberServiceClientTest.java │ │ └── TopicStatsServiceClientTest.java │ └── resources │ └── routing_tests.json ├── grpc-google-cloud-pubsublite-v1 ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── google │ └── cloud │ └── pubsublite │ └── proto │ ├── AdminServiceGrpc.java │ ├── CursorServiceGrpc.java │ ├── PartitionAssignmentServiceGrpc.java │ ├── PublisherServiceGrpc.java │ ├── SubscriberServiceGrpc.java │ └── TopicStatsServiceGrpc.java ├── java.header ├── license-checks.xml ├── owlbot.py ├── pom.xml ├── proto-google-cloud-pubsublite-v1 ├── clirr-ignored-differences.xml ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── google │ │ └── cloud │ │ └── pubsublite │ │ └── proto │ │ ├── AdminProto.java │ │ ├── AttributeValues.java │ │ ├── AttributeValuesOrBuilder.java │ │ ├── CommitCursorRequest.java │ │ ├── CommitCursorRequestOrBuilder.java │ │ ├── CommitCursorResponse.java │ │ ├── CommitCursorResponseOrBuilder.java │ │ ├── CommonProto.java │ │ ├── ComputeHeadCursorRequest.java │ │ ├── ComputeHeadCursorRequestOrBuilder.java │ │ ├── ComputeHeadCursorResponse.java │ │ ├── ComputeHeadCursorResponseOrBuilder.java │ │ ├── ComputeMessageStatsRequest.java │ │ ├── ComputeMessageStatsRequestOrBuilder.java │ │ ├── ComputeMessageStatsResponse.java │ │ ├── ComputeMessageStatsResponseOrBuilder.java │ │ ├── ComputeTimeCursorRequest.java │ │ ├── ComputeTimeCursorRequestOrBuilder.java │ │ ├── ComputeTimeCursorResponse.java │ │ ├── ComputeTimeCursorResponseOrBuilder.java │ │ ├── CreateReservationRequest.java │ │ ├── CreateReservationRequestOrBuilder.java │ │ ├── CreateSubscriptionRequest.java │ │ ├── CreateSubscriptionRequestOrBuilder.java │ │ ├── CreateTopicRequest.java │ │ ├── CreateTopicRequestOrBuilder.java │ │ ├── Cursor.java │ │ ├── CursorOrBuilder.java │ │ ├── CursorProto.java │ │ ├── DeleteReservationRequest.java │ │ ├── DeleteReservationRequestOrBuilder.java │ │ ├── DeleteSubscriptionRequest.java │ │ ├── DeleteSubscriptionRequestOrBuilder.java │ │ ├── DeleteTopicRequest.java │ │ ├── DeleteTopicRequestOrBuilder.java │ │ ├── ExportConfig.java │ │ ├── ExportConfigOrBuilder.java │ │ ├── FlowControlRequest.java │ │ ├── FlowControlRequestOrBuilder.java │ │ ├── GetReservationRequest.java │ │ ├── GetReservationRequestOrBuilder.java │ │ ├── GetSubscriptionRequest.java │ │ ├── GetSubscriptionRequestOrBuilder.java │ │ ├── GetTopicPartitionsRequest.java │ │ ├── GetTopicPartitionsRequestOrBuilder.java │ │ ├── GetTopicRequest.java │ │ ├── GetTopicRequestOrBuilder.java │ │ ├── InitialCommitCursorRequest.java │ │ ├── InitialCommitCursorRequestOrBuilder.java │ │ ├── InitialCommitCursorResponse.java │ │ ├── InitialCommitCursorResponseOrBuilder.java │ │ ├── InitialPartitionAssignmentRequest.java │ │ ├── InitialPartitionAssignmentRequestOrBuilder.java │ │ ├── InitialPublishRequest.java │ │ ├── InitialPublishRequestOrBuilder.java │ │ ├── InitialPublishResponse.java │ │ ├── InitialPublishResponseOrBuilder.java │ │ ├── InitialSubscribeRequest.java │ │ ├── InitialSubscribeRequestOrBuilder.java │ │ ├── InitialSubscribeResponse.java │ │ ├── InitialSubscribeResponseOrBuilder.java │ │ ├── ListPartitionCursorsRequest.java │ │ ├── ListPartitionCursorsRequestOrBuilder.java │ │ ├── ListPartitionCursorsResponse.java │ │ ├── ListPartitionCursorsResponseOrBuilder.java │ │ ├── ListReservationTopicsRequest.java │ │ ├── ListReservationTopicsRequestOrBuilder.java │ │ ├── ListReservationTopicsResponse.java │ │ ├── ListReservationTopicsResponseOrBuilder.java │ │ ├── ListReservationsRequest.java │ │ ├── ListReservationsRequestOrBuilder.java │ │ ├── ListReservationsResponse.java │ │ ├── ListReservationsResponseOrBuilder.java │ │ ├── ListSubscriptionsRequest.java │ │ ├── ListSubscriptionsRequestOrBuilder.java │ │ ├── ListSubscriptionsResponse.java │ │ ├── ListSubscriptionsResponseOrBuilder.java │ │ ├── ListTopicSubscriptionsRequest.java │ │ ├── ListTopicSubscriptionsRequestOrBuilder.java │ │ ├── ListTopicSubscriptionsResponse.java │ │ ├── ListTopicSubscriptionsResponseOrBuilder.java │ │ ├── ListTopicsRequest.java │ │ ├── ListTopicsRequestOrBuilder.java │ │ ├── ListTopicsResponse.java │ │ ├── ListTopicsResponseOrBuilder.java │ │ ├── LocationName.java │ │ ├── MessagePublishRequest.java │ │ ├── MessagePublishRequestOrBuilder.java │ │ ├── MessagePublishResponse.java │ │ ├── MessagePublishResponseOrBuilder.java │ │ ├── MessageResponse.java │ │ ├── MessageResponseOrBuilder.java │ │ ├── OperationMetadata.java │ │ ├── OperationMetadataOrBuilder.java │ │ ├── PartitionAssignment.java │ │ ├── PartitionAssignmentAck.java │ │ ├── PartitionAssignmentAckOrBuilder.java │ │ ├── PartitionAssignmentOrBuilder.java │ │ ├── PartitionAssignmentRequest.java │ │ ├── PartitionAssignmentRequestOrBuilder.java │ │ ├── PartitionCursor.java │ │ ├── PartitionCursorOrBuilder.java │ │ ├── PubSubMessage.java │ │ ├── PubSubMessageOrBuilder.java │ │ ├── PublishRequest.java │ │ ├── PublishRequestOrBuilder.java │ │ ├── PublishResponse.java │ │ ├── PublishResponseOrBuilder.java │ │ ├── PublisherProto.java │ │ ├── Reservation.java │ │ ├── ReservationName.java │ │ ├── ReservationOrBuilder.java │ │ ├── SeekRequest.java │ │ ├── SeekRequestOrBuilder.java │ │ ├── SeekResponse.java │ │ ├── SeekResponseOrBuilder.java │ │ ├── SeekSubscriptionRequest.java │ │ ├── SeekSubscriptionRequestOrBuilder.java │ │ ├── SeekSubscriptionResponse.java │ │ ├── SeekSubscriptionResponseOrBuilder.java │ │ ├── SequencedCommitCursorRequest.java │ │ ├── SequencedCommitCursorRequestOrBuilder.java │ │ ├── SequencedCommitCursorResponse.java │ │ ├── SequencedCommitCursorResponseOrBuilder.java │ │ ├── SequencedMessage.java │ │ ├── SequencedMessageOrBuilder.java │ │ ├── StreamingCommitCursorRequest.java │ │ ├── StreamingCommitCursorRequestOrBuilder.java │ │ ├── StreamingCommitCursorResponse.java │ │ ├── StreamingCommitCursorResponseOrBuilder.java │ │ ├── SubscribeRequest.java │ │ ├── SubscribeRequestOrBuilder.java │ │ ├── SubscribeResponse.java │ │ ├── SubscribeResponseOrBuilder.java │ │ ├── SubscriberProto.java │ │ ├── Subscription.java │ │ ├── SubscriptionName.java │ │ ├── SubscriptionOrBuilder.java │ │ ├── TimeTarget.java │ │ ├── TimeTargetOrBuilder.java │ │ ├── Topic.java │ │ ├── TopicName.java │ │ ├── TopicOrBuilder.java │ │ ├── TopicPartitions.java │ │ ├── TopicPartitionsOrBuilder.java │ │ ├── TopicStatsProto.java │ │ ├── UpdateReservationRequest.java │ │ ├── UpdateReservationRequestOrBuilder.java │ │ ├── UpdateSubscriptionRequest.java │ │ ├── UpdateSubscriptionRequestOrBuilder.java │ │ ├── UpdateTopicRequest.java │ │ └── UpdateTopicRequestOrBuilder.java │ └── proto │ └── google │ └── cloud │ └── pubsublite │ └── v1 │ ├── admin.proto │ ├── common.proto │ ├── cursor.proto │ ├── publisher.proto │ ├── subscriber.proto │ └── topic_stats.proto ├── pubsublite-beam-io └── README.md ├── renovate.json ├── samples ├── README.md ├── checkstyle-suppressions.xml ├── pom.xml ├── snapshot │ └── pom.xml └── snippets │ ├── generated │ └── com │ │ └── google │ │ └── cloud │ │ └── pubsublite │ │ └── v1 │ │ ├── adminservice │ │ ├── create │ │ │ ├── SyncCreateSetCredentialsProvider.java │ │ │ └── SyncCreateSetEndpoint.java │ │ ├── createreservation │ │ │ ├── AsyncCreateReservation.java │ │ │ ├── SyncCreateReservation.java │ │ │ ├── SyncCreateReservationLocationnameReservationString.java │ │ │ └── SyncCreateReservationStringReservationString.java │ │ ├── createsubscription │ │ │ ├── AsyncCreateSubscription.java │ │ │ ├── SyncCreateSubscription.java │ │ │ ├── SyncCreateSubscriptionLocationnameSubscriptionString.java │ │ │ └── SyncCreateSubscriptionStringSubscriptionString.java │ │ ├── createtopic │ │ │ ├── AsyncCreateTopic.java │ │ │ ├── SyncCreateTopic.java │ │ │ ├── SyncCreateTopicLocationnameTopicString.java │ │ │ └── SyncCreateTopicStringTopicString.java │ │ ├── deletereservation │ │ │ ├── AsyncDeleteReservation.java │ │ │ ├── SyncDeleteReservation.java │ │ │ ├── SyncDeleteReservationReservationname.java │ │ │ └── SyncDeleteReservationString.java │ │ ├── deletesubscription │ │ │ ├── AsyncDeleteSubscription.java │ │ │ ├── SyncDeleteSubscription.java │ │ │ ├── SyncDeleteSubscriptionString.java │ │ │ └── SyncDeleteSubscriptionSubscriptionname.java │ │ ├── deletetopic │ │ │ ├── AsyncDeleteTopic.java │ │ │ ├── SyncDeleteTopic.java │ │ │ ├── SyncDeleteTopicString.java │ │ │ └── SyncDeleteTopicTopicname.java │ │ ├── getreservation │ │ │ ├── AsyncGetReservation.java │ │ │ ├── SyncGetReservation.java │ │ │ ├── SyncGetReservationReservationname.java │ │ │ └── SyncGetReservationString.java │ │ ├── getsubscription │ │ │ ├── AsyncGetSubscription.java │ │ │ ├── SyncGetSubscription.java │ │ │ ├── SyncGetSubscriptionString.java │ │ │ └── SyncGetSubscriptionSubscriptionname.java │ │ ├── gettopic │ │ │ ├── AsyncGetTopic.java │ │ │ ├── SyncGetTopic.java │ │ │ ├── SyncGetTopicString.java │ │ │ └── SyncGetTopicTopicname.java │ │ ├── gettopicpartitions │ │ │ ├── AsyncGetTopicPartitions.java │ │ │ ├── SyncGetTopicPartitions.java │ │ │ ├── SyncGetTopicPartitionsString.java │ │ │ └── SyncGetTopicPartitionsTopicname.java │ │ ├── listreservations │ │ │ ├── AsyncListReservations.java │ │ │ ├── AsyncListReservationsPaged.java │ │ │ ├── SyncListReservations.java │ │ │ ├── SyncListReservationsLocationname.java │ │ │ └── SyncListReservationsString.java │ │ ├── listreservationtopics │ │ │ ├── AsyncListReservationTopics.java │ │ │ ├── AsyncListReservationTopicsPaged.java │ │ │ ├── SyncListReservationTopics.java │ │ │ ├── SyncListReservationTopicsReservationname.java │ │ │ └── SyncListReservationTopicsString.java │ │ ├── listsubscriptions │ │ │ ├── AsyncListSubscriptions.java │ │ │ ├── AsyncListSubscriptionsPaged.java │ │ │ ├── SyncListSubscriptions.java │ │ │ ├── SyncListSubscriptionsLocationname.java │ │ │ └── SyncListSubscriptionsString.java │ │ ├── listtopics │ │ │ ├── AsyncListTopics.java │ │ │ ├── AsyncListTopicsPaged.java │ │ │ ├── SyncListTopics.java │ │ │ ├── SyncListTopicsLocationname.java │ │ │ └── SyncListTopicsString.java │ │ ├── listtopicsubscriptions │ │ │ ├── AsyncListTopicSubscriptions.java │ │ │ ├── AsyncListTopicSubscriptionsPaged.java │ │ │ ├── SyncListTopicSubscriptions.java │ │ │ ├── SyncListTopicSubscriptionsString.java │ │ │ └── SyncListTopicSubscriptionsTopicname.java │ │ ├── seeksubscription │ │ │ ├── AsyncSeekSubscription.java │ │ │ ├── AsyncSeekSubscriptionLRO.java │ │ │ └── SyncSeekSubscription.java │ │ ├── updatereservation │ │ │ ├── AsyncUpdateReservation.java │ │ │ ├── SyncUpdateReservation.java │ │ │ └── SyncUpdateReservationReservationFieldmask.java │ │ ├── updatesubscription │ │ │ ├── AsyncUpdateSubscription.java │ │ │ ├── SyncUpdateSubscription.java │ │ │ └── SyncUpdateSubscriptionSubscriptionFieldmask.java │ │ └── updatetopic │ │ │ ├── AsyncUpdateTopic.java │ │ │ ├── SyncUpdateTopic.java │ │ │ └── SyncUpdateTopicTopicFieldmask.java │ │ ├── adminservicesettings │ │ ├── createtopic │ │ │ └── SyncCreateTopic.java │ │ └── seeksubscription │ │ │ └── SyncSeekSubscription.java │ │ ├── cursorservice │ │ ├── commitcursor │ │ │ ├── AsyncCommitCursor.java │ │ │ └── SyncCommitCursor.java │ │ ├── create │ │ │ ├── SyncCreateSetCredentialsProvider.java │ │ │ └── SyncCreateSetEndpoint.java │ │ ├── listpartitioncursors │ │ │ ├── AsyncListPartitionCursors.java │ │ │ ├── AsyncListPartitionCursorsPaged.java │ │ │ ├── SyncListPartitionCursors.java │ │ │ ├── SyncListPartitionCursorsString.java │ │ │ └── SyncListPartitionCursorsSubscriptionname.java │ │ └── streamingcommitcursor │ │ │ └── AsyncStreamingCommitCursor.java │ │ ├── cursorservicesettings │ │ └── commitcursor │ │ │ └── SyncCommitCursor.java │ │ ├── partitionassignmentservice │ │ ├── assignpartitions │ │ │ └── AsyncAssignPartitions.java │ │ └── create │ │ │ ├── SyncCreateSetCredentialsProvider.java │ │ │ └── SyncCreateSetEndpoint.java │ │ ├── partitionassignmentservicesettings │ │ └── assignpartitions │ │ │ └── SyncAssignPartitions.java │ │ ├── publisherservice │ │ ├── create │ │ │ ├── SyncCreateSetCredentialsProvider.java │ │ │ └── SyncCreateSetEndpoint.java │ │ └── publish │ │ │ └── AsyncPublish.java │ │ ├── publisherservicesettings │ │ └── publish │ │ │ └── SyncPublish.java │ │ ├── stub │ │ ├── adminservicestubsettings │ │ │ ├── createtopic │ │ │ │ └── SyncCreateTopic.java │ │ │ └── seeksubscription │ │ │ │ └── SyncSeekSubscription.java │ │ ├── cursorservicestubsettings │ │ │ └── commitcursor │ │ │ │ └── SyncCommitCursor.java │ │ ├── partitionassignmentservicestubsettings │ │ │ └── assignpartitions │ │ │ │ └── SyncAssignPartitions.java │ │ ├── publisherservicestubsettings │ │ │ └── publish │ │ │ │ └── SyncPublish.java │ │ ├── subscriberservicestubsettings │ │ │ └── subscribe │ │ │ │ └── SyncSubscribe.java │ │ └── topicstatsservicestubsettings │ │ │ └── computemessagestats │ │ │ └── SyncComputeMessageStats.java │ │ ├── subscriberservice │ │ ├── create │ │ │ ├── SyncCreateSetCredentialsProvider.java │ │ │ └── SyncCreateSetEndpoint.java │ │ └── subscribe │ │ │ └── AsyncSubscribe.java │ │ ├── subscriberservicesettings │ │ └── subscribe │ │ │ └── SyncSubscribe.java │ │ ├── topicstatsservice │ │ ├── computeheadcursor │ │ │ ├── AsyncComputeHeadCursor.java │ │ │ └── SyncComputeHeadCursor.java │ │ ├── computemessagestats │ │ │ ├── AsyncComputeMessageStats.java │ │ │ └── SyncComputeMessageStats.java │ │ ├── computetimecursor │ │ │ ├── AsyncComputeTimeCursor.java │ │ │ └── SyncComputeTimeCursor.java │ │ └── create │ │ │ ├── SyncCreateSetCredentialsProvider.java │ │ │ └── SyncCreateSetEndpoint.java │ │ └── topicstatsservicesettings │ │ └── computemessagestats │ │ └── SyncComputeMessageStats.java │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── pubsublite │ │ ├── CreatePubsubExportSubscriptionExample.java │ │ ├── CreateReservationExample.java │ │ ├── CreateSubscriptionExample.java │ │ ├── CreateTopicExample.java │ │ ├── DeleteReservationExample.java │ │ ├── DeleteSubscriptionExample.java │ │ ├── DeleteTopicExample.java │ │ ├── GetReservationExample.java │ │ ├── GetSubscriptionExample.java │ │ ├── GetTopicExample.java │ │ ├── ListReservationsExample.java │ │ ├── ListSubscriptionsInProjectExample.java │ │ ├── ListSubscriptionsInTopicExample.java │ │ ├── ListTopicsExample.java │ │ ├── PublishWithBatchSettingsExample.java │ │ ├── PublishWithCustomAttributesExample.java │ │ ├── PublishWithOrderingKeyExample.java │ │ ├── PublisherExample.java │ │ ├── SeekSubscriptionExample.java │ │ ├── SubscriberExample.java │ │ ├── UpdateReservationExample.java │ │ ├── UpdateSubscriptionExample.java │ │ └── UpdateTopicExample.java │ └── test │ └── java │ └── pubsublite │ └── QuickStartIT.java ├── synth.metadata └── versions.txt /.cloudbuild/samples_build.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - name: gcr.io/cloud-devrel-public-resources/java8 3 | entrypoint: ls 4 | args: [ 5 | '-alt', 6 | ] 7 | - name: gcr.io/cloud-devrel-public-resources/java8 8 | entrypoint: curl 9 | args: [ 10 | '--header', 11 | 'Metadata-Flavor: Google', 12 | 'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/email' 13 | ] 14 | - name: gcr.io/cloud-devrel-public-resources/java8 15 | entrypoint: pwd 16 | - name: gcr.io/cloud-devrel-public-resources/java8 17 | entrypoint: bash 18 | args: [ 19 | '.kokoro/build.sh' 20 | ] 21 | env: 22 | - 'JOB_TYPE=samples' 23 | - 'GOOGLE_CLOUD_PROJECT=cloud-java-ci-sample' 24 | - 'GOOGLE_CLOUD_PROJECT_NUMBER=615621127317' 25 | - name: gcr.io/cloud-devrel-public-resources/java8 26 | entrypoint: echo 27 | args: [ 28 | 'Sample job succeeded', 29 | ] 30 | timeout: 3600s 31 | options: 32 | defaultLogsBucketBehavior: REGIONAL_USER_OWNED_BUCKET 33 | 34 | -------------------------------------------------------------------------------- /.github/.OwlBot-hermetic.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | deep-remove-regex: 15 | - "/samples/snippets/generated" 16 | - "/grpc-google-.*/src" 17 | - "/proto-google-.*/src" 18 | - "/google-.*/src/main/java/com/google/cloud/pubsublite/v1" 19 | 20 | deep-preserve-regex: 21 | - "/google-.*/src/test/java/com/google/cloud/.*/v.*/it/IT.*Test.java" 22 | 23 | deep-copy-regex: 24 | - source: "/google/cloud/pubsublite/(v.*)/.*-java/proto-google-.*/src" 25 | dest: "/owl-bot-staging/$1/proto-google-cloud-pubsublite-$1/src" 26 | - source: "/google/cloud/pubsublite/(v.*)/.*-java/grpc-google-.*/src" 27 | dest: "/owl-bot-staging/$1/grpc-google-cloud-pubsublite-$1/src" 28 | - source: "/google/cloud/pubsublite/(v.*)/.*-java/gapic-google-.*/src" 29 | dest: "/owl-bot-staging/$1/google-cloud-pubsublite/src" 30 | - source: "/google/cloud/pubsublite/(v.*)/.*-java/samples/snippets/generated" 31 | dest: "/owl-bot-staging/$1/samples/snippets/generated" 32 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Code owners file. 2 | # This file controls who is tagged for review for any given pull request. 3 | 4 | # For syntax help see: 5 | # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax 6 | 7 | # The @googleapis/api-pubsublite is the default owner for changes in this repo 8 | * @googleapis/yoshi-java @googleapis/api-pubsublite 9 | 10 | # for handwritten libraries, keep codeowner_team in .repo-metadata.json as owner 11 | **/*.java @googleapis/yoshi-java @googleapis/api-pubsublite 12 | 13 | 14 | # The java-samples-reviewers team is the default owner for samples changes 15 | samples/**/*.java @googleapis/java-samples-reviewers 16 | 17 | # Generated snippets should not be owned by samples reviewers 18 | samples/snippets/generated/ @googleapis/yoshi-java 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | Thanks for stopping by to let us know something could be better! 8 | 9 | **PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. 10 | 11 | Please run down the following list and make sure you've tried the usual "quick fixes": 12 | 13 | - Search the issues already opened: https://github.com/googleapis/java-pubsublite/issues 14 | - Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform 15 | 16 | If you are still having issues, please include as much information as possible: 17 | 18 | #### Environment details 19 | 20 | 1. Specify the API at the beginning of the title. For example, "BigQuery: ..."). 21 | General, Core, and Other are also allowed as types 22 | 2. OS type and version: 23 | 3. Java version: 24 | 4. version(s): 25 | 26 | #### Steps to reproduce 27 | 28 | 1. ? 29 | 2. ? 30 | 31 | #### Code example 32 | 33 | ```java 34 | // example 35 | ``` 36 | 37 | #### Stack trace 38 | ``` 39 | Any relevant stacktrace here. 40 | ``` 41 | 42 | #### External references such as API reference guides 43 | 44 | - ? 45 | 46 | #### Any additional information below 47 | 48 | 49 | Following these steps guarantees the quickest resolution possible. 50 | 51 | Thanks! 52 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this library 4 | 5 | --- 6 | 7 | Thanks for stopping by to let us know something could be better! 8 | 9 | **PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. 10 | 11 | **Is your feature request related to a problem? Please describe.** 12 | What the problem is. Example: I'm always frustrated when [...] 13 | 14 | **Describe the solution you'd like** 15 | What you want to happen. 16 | 17 | **Describe alternatives you've considered** 18 | Any alternative solutions or features you've considered. 19 | 20 | **Additional context** 21 | Any other context or screenshots about the feature request. 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/support_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Support request 3 | about: If you have a support contract with Google, please create an issue in the Google Cloud Support console. 4 | 5 | --- 6 | 7 | **PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. 8 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: 2 | - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-pubsublite/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea 3 | - [ ] Ensure the tests and linter pass 4 | - [ ] Code coverage does not decrease (if any source code was changed) 5 | - [ ] Appropriate docs were updated (if necessary) 6 | 7 | Fixes # ☕️ 8 | 9 | If you write sample code, please follow the [samples format]( 10 | https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md). 11 | -------------------------------------------------------------------------------- /.github/auto-label.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | requestsize: 15 | enabled: true 16 | -------------------------------------------------------------------------------- /.github/blunderbuss.yml: -------------------------------------------------------------------------------- 1 | # Configuration for the Blunderbuss GitHub app. For more info see 2 | # https://github.com/googleapis/repo-automation-bots/tree/main/packages/blunderbuss 3 | assign_prs_by: 4 | - labels: 5 | - samples 6 | to: 7 | - googleapis/java-samples-reviewers -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "maven" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | # Disable version updates for Maven dependencies 8 | # we use renovate-bot as well as shared-dependencies BOM to update maven dependencies. 9 | ignore: 10 | - dependency-name: "*" 11 | - package-ecosystem: "pip" 12 | directory: "/" 13 | schedule: 14 | interval: "daily" 15 | # Disable version updates for pip dependencies 16 | # If a security vulnerability comes in, we will be notified about 17 | # it via template in the synthtool repository. 18 | ignore: 19 | - dependency-name: "*" 20 | -------------------------------------------------------------------------------- /.github/generated-files-bot.yml: -------------------------------------------------------------------------------- 1 | externalManifests: 2 | - type: json 3 | file: 'synth.metadata' 4 | jsonpath: '$.generatedFiles[*]' 5 | - type: json 6 | file: '.github/readme/synth.metadata/synth.metadata' 7 | jsonpath: '$.generatedFiles[*]' 8 | ignoreAuthors: 9 | - 'cloud-java-bot' 10 | - 'renovate-bot' 11 | - 'yoshi-automation' 12 | - 'release-please[bot]' 13 | - 'gcf-owl-bot[bot]' 14 | -------------------------------------------------------------------------------- /.github/release-please.yml: -------------------------------------------------------------------------------- 1 | bumpMinorPreMajor: true 2 | handleGHRelease: true 3 | releaseType: java-yoshi 4 | branches: 5 | - bumpMinorPreMajor: true 6 | handleGHRelease: true 7 | releaseType: java-yoshi 8 | branch: java7 9 | -------------------------------------------------------------------------------- /.github/release-trigger.yml: -------------------------------------------------------------------------------- 1 | enabled: true 2 | multiScmName: java-pubsublite 3 | -------------------------------------------------------------------------------- /.github/snippet-bot.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/java-pubsublite/b9af4ce5597f40fc2e88f3b90b9ee3b4637a30f7/.github/snippet-bot.yml -------------------------------------------------------------------------------- /.github/sync-repo-settings.yaml: -------------------------------------------------------------------------------- 1 | rebaseMergeAllowed: false 2 | squashMergeAllowed: true 3 | mergeCommitAllowed: false 4 | branchProtectionRules: 5 | - pattern: main 6 | isAdminEnforced: true 7 | requiredApprovingReviewCount: 1 8 | requiresCodeOwnerReviews: true 9 | requiresStrictStatusChecks: false 10 | requiredStatusCheckContexts: 11 | - dependencies (17) 12 | - javadoc 13 | - lint 14 | - clirr 15 | - units (8) 16 | - units (11) 17 | - 'Kokoro - Test: Integration' 18 | - cla/google 19 | - 'Kokoro - Test: Java GraalVM Native Image' 20 | - 'Kokoro - Test: Java 17 GraalVM Native Image' 21 | - library_generation 22 | - unmanaged_dependency_check 23 | - pattern: java7 24 | isAdminEnforced: true 25 | requiredApprovingReviewCount: 1 26 | requiresCodeOwnerReviews: true 27 | requiresStrictStatusChecks: false 28 | requiredStatusCheckContexts: 29 | - dependencies (8) 30 | - dependencies (11) 31 | - lint 32 | - clirr 33 | - units (8) 34 | - units (11) 35 | - 'Kokoro - Test: Integration' 36 | - 'Kokoro - Test: Samples' 37 | - cla/google 38 | permissionRules: 39 | - team: yoshi-admins 40 | permission: admin 41 | - team: yoshi-java-admins 42 | permission: admin 43 | - team: yoshi-java 44 | permission: push 45 | - team: api-pubsublite 46 | permission: admin 47 | -------------------------------------------------------------------------------- /.github/trusted-contribution.yml: -------------------------------------------------------------------------------- 1 | trustedContributors: 2 | - renovate-bot 3 | - gcf-owl-bot[bot] 4 | 5 | annotations: 6 | - type: comment 7 | text: "/gcbrun" 8 | - type: label 9 | text: "kokoro:force-run" 10 | -------------------------------------------------------------------------------- /.github/workflows/hermetic_library_generation.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # GitHub action job to test core java library features on 15 | # downstream client libraries before they are released. 16 | name: Hermetic library generation upon generation config change through pull requests 17 | on: 18 | pull_request: 19 | 20 | env: 21 | REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }} 22 | GITHUB_REPOSITORY: ${{ github.repository }} 23 | jobs: 24 | library_generation: 25 | runs-on: ubuntu-latest 26 | steps: 27 | - name: Determine whether the pull request comes from a fork 28 | run: | 29 | if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then 30 | echo "This PR comes from a fork. Skip library generation." 31 | echo "SHOULD_RUN=false" >> $GITHUB_ENV 32 | else 33 | echo "SHOULD_RUN=true" >> $GITHUB_ENV 34 | fi 35 | - uses: actions/checkout@v4 36 | if: env.SHOULD_RUN == 'true' 37 | with: 38 | fetch-depth: 0 39 | token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} 40 | - uses: googleapis/sdk-platform-java/.github/scripts@v2.59.0 41 | if: env.SHOULD_RUN == 'true' 42 | with: 43 | base_ref: ${{ github.base_ref }} 44 | head_ref: ${{ github.head_ref }} 45 | token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} 46 | -------------------------------------------------------------------------------- /.github/workflows/renovate_config_check.yaml: -------------------------------------------------------------------------------- 1 | name: Renovate Bot Config Validation 2 | 3 | on: 4 | pull_request: 5 | paths: 6 | - 'renovate.json' 7 | 8 | jobs: 9 | renovate_bot_config_validation: 10 | runs-on: ubuntu-24.04 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v4 15 | 16 | - name: Set up Node.js 17 | uses: actions/setup-node@v4 18 | with: 19 | node-version: '22' 20 | 21 | - name: Install Renovate and Config Validator 22 | run: | 23 | npm install -g npm@latest 24 | npm install --global renovate 25 | renovate-config-validator 26 | -------------------------------------------------------------------------------- /.github/workflows/samples.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | name: samples 4 | jobs: 5 | checkstyle: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v4 9 | - uses: actions/setup-java@v1 10 | with: 11 | java-version: 11 12 | - name: Run checkstyle 13 | run: mvn -P lint --quiet --batch-mode checkstyle:check 14 | working-directory: samples 15 | -------------------------------------------------------------------------------- /.github/workflows/unmanaged_dependency_check.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | name: Unmanaged dependency check 4 | jobs: 5 | unmanaged_dependency_check: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v4 9 | - uses: actions/setup-java@v4 10 | with: 11 | distribution: temurin 12 | java-version: 11 13 | - name: Install modules 14 | shell: bash 15 | run: | 16 | # No argument to build.sh installs the modules in local Maven 17 | # repository 18 | .kokoro/build.sh 19 | - name: Unmanaged dependency check 20 | uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.49.0 21 | with: 22 | bom-path: google-cloud-pubsublite-bom/pom.xml 23 | -------------------------------------------------------------------------------- /.github/workflows/update_generation_config.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # GitHub action job to test core java library features on 15 | # downstream client libraries before they are released. 16 | name: Update generation configuration 17 | on: 18 | schedule: 19 | - cron: '0 2 * * *' 20 | workflow_dispatch: 21 | 22 | jobs: 23 | update-generation-config: 24 | runs-on: ubuntu-24.04 25 | env: 26 | # the branch into which the pull request is merged 27 | base_branch: main 28 | steps: 29 | - uses: actions/checkout@v4 30 | with: 31 | fetch-depth: 0 32 | token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} 33 | - name: Update params in generation config to latest 34 | shell: bash 35 | run: | 36 | set -x 37 | [ -z "$(git config user.email)" ] && git config --global user.email "cloud-java-bot@google.com" 38 | [ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot" 39 | bash .github/scripts/update_generation_config.sh \ 40 | --base_branch "${base_branch}" \ 41 | --repo ${{ github.repository }} 42 | env: 43 | GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} 44 | 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | 25 | # intellij project folder 26 | .idea/ 27 | *.iml 28 | 29 | # maven build directory 30 | target/ 31 | 32 | .flattened-pom.xml -------------------------------------------------------------------------------- /.kokoro/build.bat: -------------------------------------------------------------------------------- 1 | :: Copyright 2022 Google LLC 2 | :: 3 | :: Licensed under the Apache License, Version 2.0 (the "License"); 4 | :: you may not use this file except in compliance with the License. 5 | :: You may obtain a copy of the License at 6 | :: 7 | :: http://www.apache.org/licenses/LICENSE-2.0 8 | :: 9 | :: Unless required by applicable law or agreed to in writing, software 10 | :: distributed under the License is distributed on an "AS IS" BASIS, 11 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | :: See the License for the specific language governing permissions and 13 | :: limitations under the License. 14 | :: Github action job to test core java library features on 15 | :: downstream client libraries before they are released. 16 | :: See documentation in type-shell-output.bat 17 | 18 | "C:\Program Files\Git\bin\bash.exe" %~dp0build.sh 19 | -------------------------------------------------------------------------------- /.kokoro/coerce_logs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2019 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # This script finds and moves sponge logs so that they can be found by placer 17 | # and are not flagged as flaky by sponge. 18 | 19 | set -eo pipefail 20 | 21 | ## Get the directory of the build script 22 | scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) 23 | ## cd to the parent directory, i.e. the root of the git repo 24 | cd ${scriptDir}/.. 25 | 26 | job=$(basename ${KOKORO_JOB_NAME}) 27 | 28 | echo "coercing sponge logs..." 29 | for xml in `find . -name *-sponge_log.xml` 30 | do 31 | class=$(basename ${xml} | cut -d- -f2) 32 | dir=$(dirname ${xml})/${job}/${class} 33 | text=$(dirname ${xml})/${class}-sponge_log.txt 34 | mkdir -p ${dir} 35 | mv ${xml} ${dir}/sponge_log.xml 36 | mv ${text} ${dir}/sponge_log.txt 37 | done 38 | -------------------------------------------------------------------------------- /.kokoro/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} 4 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 5 | 6 | # All builds use the trampoline script to run in docker. 7 | build_file: "java-pubsublite/.kokoro/trampoline.sh" 8 | 9 | # Tell the trampoline which build file to use. 10 | env_vars: { 11 | key: "TRAMPOLINE_BUILD_FILE" 12 | value: "github/java-pubsublite/.kokoro/build.sh" 13 | } 14 | -------------------------------------------------------------------------------- /.kokoro/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2020 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | function retry_with_backoff { 17 | attempts_left=$1 18 | sleep_seconds=$2 19 | shift 2 20 | command=$@ 21 | 22 | 23 | # store current flag state 24 | flags=$- 25 | 26 | # allow a failures to continue 27 | set +e 28 | ${command} 29 | exit_code=$? 30 | 31 | # restore "e" flag 32 | if [[ ${flags} =~ e ]] 33 | then set -e 34 | else set +e 35 | fi 36 | 37 | if [[ $exit_code == 0 ]] 38 | then 39 | return 0 40 | fi 41 | 42 | # failure 43 | if [[ ${attempts_left} > 0 ]] 44 | then 45 | echo "failure (${exit_code}), sleeping ${sleep_seconds}..." 46 | sleep ${sleep_seconds} 47 | new_attempts=$((${attempts_left} - 1)) 48 | new_sleep=$((${sleep_seconds} * 2)) 49 | retry_with_backoff ${new_attempts} ${new_sleep} ${command} 50 | fi 51 | 52 | return $exit_code 53 | } 54 | 55 | ## Helper functionss 56 | function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } 57 | function msg() { println "$*" >&2; } 58 | function println() { printf '%s\n' "$(now) $*"; } 59 | 60 | ## Helper comment to trigger updated repo dependency release -------------------------------------------------------------------------------- /.kokoro/continuous/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Build logs will be here 4 | action { 5 | define_artifacts { 6 | regex: "**/*sponge_log.xml" 7 | regex: "**/*sponge_log.txt" 8 | } 9 | } 10 | 11 | # Download trampoline resources. 12 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 13 | 14 | # Use the trampoline script to run in docker. 15 | build_file: "java-pubsublite/.kokoro/trampoline.sh" 16 | 17 | env_vars: { 18 | key: "TRAMPOLINE_BUILD_FILE" 19 | value: "github/java-pubsublite/.kokoro/build.sh" 20 | } 21 | 22 | env_vars: { 23 | key: "JOB_TYPE" 24 | value: "test" 25 | } 26 | -------------------------------------------------------------------------------- /.kokoro/continuous/java8.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "REPORT_COVERAGE" 11 | value: "true" 12 | } 13 | -------------------------------------------------------------------------------- /.kokoro/continuous/samples.cfg: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Format: //devtools/kokoro/config/proto/build.proto 16 | 17 | # Download secrets from Cloud Storage. 18 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples" 19 | 20 | # Configure the docker image for kokoro-trampoline. 21 | env_vars: { 22 | key: "TRAMPOLINE_IMAGE" 23 | value: "gcr.io/cloud-devrel-kokoro-resources/java11" 24 | } 25 | 26 | # Tell trampoline which tests to run. 27 | env_vars: { 28 | key: "TRAMPOLINE_BUILD_FILE" 29 | value: "github/java-pubsublite/.kokoro/run_samples_tests.sh" 30 | } 31 | 32 | env_vars: { 33 | key: "GCLOUD_PROJECT" 34 | value: "java-docs-samples-testing" 35 | } 36 | 37 | env_vars: { 38 | key: "GOOGLE_CLOUD_PROJECT" 39 | value: "java-docs-samples-testing" 40 | } 41 | 42 | env_vars: { 43 | key: "GOOGLE_CLOUD_PROJECT_NUMBER" 44 | value: "779844219229" 45 | } 46 | 47 | env_vars: { 48 | key: "GOOGLE_APPLICATION_CREDENTIALS" 49 | value: "secret_manager/java-docs-samples-service-account" 50 | } 51 | 52 | env_vars: { 53 | key: "SECRET_MANAGER_KEYS" 54 | value: "java-docs-samples-service-account" 55 | } -------------------------------------------------------------------------------- /.kokoro/dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2019 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -eo pipefail 17 | shopt -s nullglob 18 | 19 | ## Get the directory of the build script 20 | scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) 21 | ## cd to the parent directory, i.e. the root of the git repo 22 | cd ${scriptDir}/.. 23 | 24 | # include common functions 25 | source ${scriptDir}/common.sh 26 | 27 | # Print out Java 28 | java -version 29 | echo $JOB_TYPE 30 | 31 | function determineMavenOpts() { 32 | local javaVersion=$( 33 | # filter down to the version line, then pull out the version between quotes, 34 | # then trim the version number down to its minimal number (removing any 35 | # update or suffix number). 36 | java -version 2>&1 | grep "version" \ 37 | | sed -E 's/^.*"(.*?)".*$/\1/g' \ 38 | | sed -E 's/^(1\.[0-9]\.0).*$/\1/g' 39 | ) 40 | 41 | if [[ $javaVersion == 17* ]] 42 | then 43 | # MaxPermSize is no longer supported as of jdk 17 44 | echo -n "-Xmx1024m" 45 | else 46 | echo -n "-Xmx1024m -XX:MaxPermSize=128m" 47 | fi 48 | } 49 | 50 | export MAVEN_OPTS=$(determineMavenOpts) 51 | 52 | # this should run maven enforcer 53 | retry_with_backoff 3 10 \ 54 | mvn install -B -V -ntp \ 55 | -DskipTests=true \ 56 | -Dmaven.javadoc.skip=true \ 57 | -Dclirr.skip=true 58 | 59 | mvn -B dependency:analyze -DfailOnWarning=true 60 | -------------------------------------------------------------------------------- /.kokoro/nightly/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Build logs will be here 4 | action { 5 | define_artifacts { 6 | regex: "**/*sponge_log.xml" 7 | regex: "**/*sponge_log.txt" 8 | } 9 | } 10 | 11 | # Download trampoline resources. 12 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 13 | 14 | # Use the trampoline script to run in docker. 15 | build_file: "java-pubsublite/.kokoro/trampoline.sh" 16 | 17 | env_vars: { 18 | key: "TRAMPOLINE_BUILD_FILE" 19 | value: "github/java-pubsublite/.kokoro/build.sh" 20 | } 21 | 22 | env_vars: { 23 | key: "JOB_TYPE" 24 | value: "test" 25 | } 26 | -------------------------------------------------------------------------------- /.kokoro/nightly/integration.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "integration" 12 | } 13 | # TODO: remove this after we've migrated all tests and scripts 14 | env_vars: { 15 | key: "GCLOUD_PROJECT" 16 | value: "java-docs-samples-testing" 17 | } 18 | 19 | env_vars: { 20 | key: "GOOGLE_CLOUD_PROJECT" 21 | value: "java-docs-samples-testing" 22 | } 23 | 24 | env_vars: { 25 | key: "ENABLE_FLAKYBOT" 26 | value: "true" 27 | } 28 | 29 | env_vars: { 30 | key: "GOOGLE_APPLICATION_CREDENTIALS" 31 | value: "secret_manager/java-it-service-account" 32 | } 33 | 34 | env_vars: { 35 | key: "SECRET_MANAGER_KEYS" 36 | value: "java-it-service-account" 37 | } 38 | 39 | -------------------------------------------------------------------------------- /.kokoro/nightly/java11-integration.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-public-resources/java11014" 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "integration" 12 | } 13 | # TODO: remove this after we've migrated all tests and scripts 14 | env_vars: { 15 | key: "GCLOUD_PROJECT" 16 | value: "gcloud-devel" 17 | } 18 | 19 | env_vars: { 20 | key: "GOOGLE_CLOUD_PROJECT" 21 | value: "gcloud-devel" 22 | } 23 | 24 | env_vars: { 25 | key: "ENABLE_FLAKYBOT" 26 | value: "true" 27 | } 28 | 29 | env_vars: { 30 | key: "GOOGLE_APPLICATION_CREDENTIALS" 31 | value: "secret_manager/java-it-service-account" 32 | } 33 | 34 | env_vars: { 35 | key: "SECRET_MANAGER_KEYS" 36 | value: "java-it-service-account" 37 | } 38 | 39 | -------------------------------------------------------------------------------- /.kokoro/nightly/java11.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java11" 7 | } 8 | -------------------------------------------------------------------------------- /.kokoro/nightly/java7.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java7" 7 | } 8 | -------------------------------------------------------------------------------- /.kokoro/nightly/java8-osx.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "java-pubsublite/.kokoro/build.sh" 4 | -------------------------------------------------------------------------------- /.kokoro/nightly/java8-win.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "java-pubsublite/.kokoro/build.bat" 4 | -------------------------------------------------------------------------------- /.kokoro/nightly/java8.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "REPORT_COVERAGE" 11 | value: "true" 12 | } 13 | -------------------------------------------------------------------------------- /.kokoro/nightly/samples.cfg: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Format: //devtools/kokoro/config/proto/build.proto 16 | 17 | # Download secrets from Cloud Storage. 18 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples" 19 | 20 | # Configure the docker image for kokoro-trampoline. 21 | env_vars: { 22 | key: "TRAMPOLINE_IMAGE" 23 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 24 | } 25 | 26 | env_vars: { 27 | key: "JOB_TYPE" 28 | value: "samples" 29 | } 30 | 31 | env_vars: { 32 | key: "GCLOUD_PROJECT" 33 | value: "java-docs-samples-testing" 34 | } 35 | 36 | env_vars: { 37 | key: "GOOGLE_CLOUD_PROJECT" 38 | value: "java-docs-samples-testing" 39 | } 40 | 41 | env_vars: { 42 | key: "GOOGLE_CLOUD_PROJECT_NUMBER" 43 | value: "779844219229" 44 | } 45 | 46 | env_vars: { 47 | key: "GOOGLE_APPLICATION_CREDENTIALS" 48 | value: "secret_manager/java-docs-samples-service-account" 49 | } 50 | 51 | env_vars: { 52 | key: "SECRET_MANAGER_KEYS" 53 | value: "java-docs-samples-service-account" 54 | } -------------------------------------------------------------------------------- /.kokoro/populate-secrets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2020 Google LLC. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -eo pipefail 17 | 18 | function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} 19 | function msg { println "$*" >&2 ;} 20 | function println { printf '%s\n' "$(now) $*" ;} 21 | 22 | 23 | # Populates requested secrets set in SECRET_MANAGER_KEYS from service account: 24 | # kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com 25 | SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" 26 | msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" 27 | mkdir -p ${SECRET_LOCATION} 28 | for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") 29 | do 30 | msg "Retrieving secret ${key}" 31 | docker run --entrypoint=gcloud \ 32 | --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ 33 | gcr.io/google.com/cloudsdktool/cloud-sdk \ 34 | secrets versions access latest \ 35 | --project cloud-devrel-kokoro-resources \ 36 | --secret ${key} > \ 37 | "${SECRET_LOCATION}/${key}" 38 | if [[ $? == 0 ]]; then 39 | msg "Secret written to ${SECRET_LOCATION}/${key}" 40 | else 41 | msg "Error retrieving secret ${key}" 42 | fi 43 | done 44 | -------------------------------------------------------------------------------- /.kokoro/presubmit/clirr.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | 5 | env_vars: { 6 | key: "TRAMPOLINE_IMAGE" 7 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 8 | } 9 | 10 | env_vars: { 11 | key: "JOB_TYPE" 12 | value: "clirr" 13 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Build logs will be here 4 | action { 5 | define_artifacts { 6 | regex: "**/*sponge_log.xml" 7 | regex: "**/*sponge_log.txt" 8 | } 9 | } 10 | 11 | # Download trampoline resources. 12 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 13 | 14 | # Use the trampoline script to run in docker. 15 | build_file: "java-pubsublite/.kokoro/trampoline.sh" 16 | 17 | env_vars: { 18 | key: "TRAMPOLINE_BUILD_FILE" 19 | value: "github/java-pubsublite/.kokoro/build.sh" 20 | } 21 | 22 | env_vars: { 23 | key: "JOB_TYPE" 24 | value: "test" 25 | } 26 | 27 | before_action { 28 | fetch_keystore { 29 | keystore_resource { 30 | keystore_config_id: 73713 31 | keyname: "dpebot_codecov_token" 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /.kokoro/presubmit/dependencies.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "TRAMPOLINE_BUILD_FILE" 11 | value: "github/java-pubsublite/.kokoro/dependencies.sh" 12 | } 13 | -------------------------------------------------------------------------------- /.kokoro/presubmit/graalvm-native-17.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.49.0" 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "graalvm17" 12 | } 13 | 14 | # TODO: remove this after we've migrated all tests and scripts 15 | env_vars: { 16 | key: "GCLOUD_PROJECT" 17 | value: "gcloud-devel" 18 | } 19 | 20 | env_vars: { 21 | key: "GOOGLE_CLOUD_PROJECT" 22 | value: "gcloud-devel" 23 | } 24 | 25 | env_vars: { 26 | key: "GOOGLE_APPLICATION_CREDENTIALS" 27 | value: "secret_manager/java-it-service-account" 28 | } 29 | 30 | env_vars: { 31 | key: "SECRET_MANAGER_KEYS" 32 | value: "java-it-service-account" 33 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/graalvm-native-a.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.49.0" # {x-version-update:google-cloud-shared-dependencies:current} 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "graalvm" 12 | } 13 | 14 | # TODO: remove this after we've migrated all tests and scripts 15 | env_vars: { 16 | key: "GCLOUD_PROJECT" 17 | value: "gcloud-devel" 18 | } 19 | 20 | env_vars: { 21 | key: "GOOGLE_CLOUD_PROJECT" 22 | value: "gcloud-devel" 23 | } 24 | 25 | env_vars: { 26 | key: "GOOGLE_APPLICATION_CREDENTIALS" 27 | value: "secret_manager/java-it-service-account" 28 | } 29 | 30 | env_vars: { 31 | key: "SECRET_MANAGER_KEYS" 32 | value: "java-it-service-account" 33 | } 34 | 35 | env_vars: { 36 | key: "IT_SERVICE_ACCOUNT_EMAIL" 37 | value: "it-service-account@gcloud-devel.iam.gserviceaccount.com" 38 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/graalvm-native-b.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.49.0" # {x-version-update:google-cloud-shared-dependencies:current} 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "graalvm" 12 | } 13 | 14 | # TODO: remove this after we've migrated all tests and scripts 15 | env_vars: { 16 | key: "GCLOUD_PROJECT" 17 | value: "gcloud-devel" 18 | } 19 | 20 | env_vars: { 21 | key: "GOOGLE_CLOUD_PROJECT" 22 | value: "gcloud-devel" 23 | } 24 | 25 | env_vars: { 26 | key: "GOOGLE_APPLICATION_CREDENTIALS" 27 | value: "secret_manager/java-it-service-account" 28 | } 29 | 30 | env_vars: { 31 | key: "SECRET_MANAGER_KEYS" 32 | value: "java-it-service-account" 33 | } 34 | 35 | env_vars: { 36 | key: "IT_SERVICE_ACCOUNT_EMAIL" 37 | value: "it-service-account@gcloud-devel.iam.gserviceaccount.com" 38 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/graalvm-native-c.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_c:3.49.0" # {x-version-update:google-cloud-shared-dependencies:current} 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "graalvm" 12 | } 13 | 14 | # TODO: remove this after we've migrated all tests and scripts 15 | env_vars: { 16 | key: "GCLOUD_PROJECT" 17 | value: "gcloud-devel" 18 | } 19 | 20 | env_vars: { 21 | key: "GOOGLE_CLOUD_PROJECT" 22 | value: "gcloud-devel" 23 | } 24 | 25 | env_vars: { 26 | key: "GOOGLE_APPLICATION_CREDENTIALS" 27 | value: "secret_manager/java-it-service-account" 28 | } 29 | 30 | env_vars: { 31 | key: "SECRET_MANAGER_KEYS" 32 | value: "java-it-service-account" 33 | } 34 | 35 | env_vars: { 36 | key: "IT_SERVICE_ACCOUNT_EMAIL" 37 | value: "it-service-account@gcloud-devel.iam.gserviceaccount.com" 38 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/graalvm-native.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.49.0" 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "graalvm" 12 | } 13 | 14 | # TODO: remove this after we've migrated all tests and scripts 15 | env_vars: { 16 | key: "GCLOUD_PROJECT" 17 | value: "gcloud-devel" 18 | } 19 | 20 | env_vars: { 21 | key: "GOOGLE_CLOUD_PROJECT" 22 | value: "gcloud-devel" 23 | } 24 | 25 | env_vars: { 26 | key: "GOOGLE_APPLICATION_CREDENTIALS" 27 | value: "secret_manager/java-it-service-account" 28 | } 29 | 30 | env_vars: { 31 | key: "SECRET_MANAGER_KEYS" 32 | value: "java-it-service-account" 33 | } 34 | -------------------------------------------------------------------------------- /.kokoro/presubmit/integration.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "JOB_TYPE" 11 | value: "integration" 12 | } 13 | 14 | # TODO: remove this after we've migrated all tests and scripts 15 | env_vars: { 16 | key: "GCLOUD_PROJECT" 17 | value: "gcloud-devel" 18 | } 19 | 20 | env_vars: { 21 | key: "GOOGLE_CLOUD_PROJECT" 22 | value: "gcloud-devel" 23 | } 24 | 25 | env_vars: { 26 | key: "GOOGLE_APPLICATION_CREDENTIALS" 27 | value: "secret_manager/java-it-service-account" 28 | } 29 | 30 | env_vars: { 31 | key: "SECRET_MANAGER_KEYS" 32 | value: "java-it-service-account" 33 | } 34 | 35 | -------------------------------------------------------------------------------- /.kokoro/presubmit/java11.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java11" 7 | } 8 | -------------------------------------------------------------------------------- /.kokoro/presubmit/java7.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java7" 7 | } 8 | -------------------------------------------------------------------------------- /.kokoro/presubmit/java8-osx.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "java-pubsublite/.kokoro/build.sh" 4 | -------------------------------------------------------------------------------- /.kokoro/presubmit/java8-win.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "java-pubsublite/.kokoro/build.bat" 4 | -------------------------------------------------------------------------------- /.kokoro/presubmit/java8.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "REPORT_COVERAGE" 11 | value: "true" 12 | } 13 | -------------------------------------------------------------------------------- /.kokoro/presubmit/linkage-monitor.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | env_vars: { 5 | key: "TRAMPOLINE_IMAGE" 6 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 7 | } 8 | 9 | env_vars: { 10 | key: "TRAMPOLINE_BUILD_FILE" 11 | value: "github/java-pubsublite/.kokoro/linkage-monitor.sh" 12 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/lint.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Configure the docker image for kokoro-trampoline. 4 | 5 | env_vars: { 6 | key: "TRAMPOLINE_IMAGE" 7 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 8 | } 9 | 10 | env_vars: { 11 | key: "JOB_TYPE" 12 | value: "lint" 13 | } -------------------------------------------------------------------------------- /.kokoro/presubmit/samples.cfg: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Format: //devtools/kokoro/config/proto/build.proto 16 | 17 | # Download secrets from Cloud Storage. 18 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java-docs-samples" 19 | 20 | # Configure the docker image for kokoro-trampoline. 21 | env_vars: { 22 | key: "TRAMPOLINE_IMAGE" 23 | value: "gcr.io/cloud-devrel-kokoro-resources/java8" 24 | } 25 | 26 | env_vars: { 27 | key: "JOB_TYPE" 28 | value: "samples" 29 | } 30 | 31 | env_vars: { 32 | key: "GCLOUD_PROJECT" 33 | value: "java-docs-samples-testing" 34 | } 35 | 36 | env_vars: { 37 | key: "GOOGLE_CLOUD_PROJECT" 38 | value: "java-docs-samples-testing" 39 | } 40 | 41 | env_vars: { 42 | key: "GOOGLE_CLOUD_PROJECT_NUMBER" 43 | value: "779844219229" 44 | } 45 | 46 | env_vars: { 47 | key: "GOOGLE_APPLICATION_CREDENTIALS" 48 | value: "secret_manager/java-docs-samples-service-account" 49 | } 50 | 51 | env_vars: { 52 | key: "SECRET_MANAGER_KEYS" 53 | value: "java-docs-samples-service-account" 54 | } 55 | 56 | env_vars: { 57 | key: "ENABLE_FLAKYBOT" 58 | value: "true" 59 | } -------------------------------------------------------------------------------- /.kokoro/readme.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2020 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -eo pipefail 17 | 18 | cd ${KOKORO_ARTIFACTS_DIR}/github/java-pubsublite 19 | 20 | # Disable buffering, so that the logs stream through. 21 | export PYTHONUNBUFFERED=1 22 | 23 | # Kokoro exposes this as a file, but the scripts expect just a plain variable. 24 | export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key) 25 | 26 | # Setup git credentials 27 | echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials 28 | git config --global credential.helper 'store --file ~/.git-credentials' 29 | 30 | python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool 31 | 32 | set +e 33 | python3.6 -m autosynth.synth \ 34 | --repository=googleapis/java-pubsublite \ 35 | --synth-file-name=.github/readme/synth.py \ 36 | --metadata-path=.github/readme/synth.metadata \ 37 | --pr-title="chore: regenerate README" \ 38 | --branch-suffix="readme" 39 | 40 | # autosynth returns 28 to signal there are no changes 41 | RETURN_CODE=$? 42 | if [[ ${RETURN_CODE} -ne 0 && ${RETURN_CODE} -ne 28 ]] 43 | then 44 | exit ${RETURN_CODE} 45 | fi 46 | -------------------------------------------------------------------------------- /.kokoro/trampoline.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2018 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | set -eo pipefail 16 | # Always run the cleanup script, regardless of the success of bouncing into 17 | # the container. 18 | function cleanup() { 19 | chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh 20 | ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh 21 | echo "cleanup"; 22 | } 23 | trap cleanup EXIT 24 | 25 | $(dirname $0)/populate-secrets.sh # Secret Manager secrets. 26 | python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" 27 | -------------------------------------------------------------------------------- /.repo-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "api_shortname": "pubsublite", 3 | "name_pretty": "Cloud Pub/Sub Lite", 4 | "product_documentation": "https://cloud.google.com/pubsub/lite/docs", 5 | "api_description": "is designed to provide reliable, many-to-many, asynchronous messaging between applications. Publisher\\napplications can send messages to a topic and other applications can\\nsubscribe to that topic to receive the messages. By decoupling senders and\\nreceivers, Google Cloud Pub/Sub allows developers to communicate between\\nindependently written applications.\\n\\nCompared to Google Pub/Sub, Pub/Sub Lite provides partitioned zonal data\\nstorage with predefined capacity. Both products present a similar API, but\\nPub/Sub Lite has more usage caveats.\\n\\nSee the [Google Pub/Sub Lite docs](https://cloud.google.com/pubsub/quickstart-console#before-you-begin) for more details on how to activate\\nPub/Sub Lite for your project, as well as guidance on how to choose between\\nCloud Pub/Sub and Pub/Sub Lite.", 6 | "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/history", 7 | "release_level": "stable", 8 | "transport": "grpc", 9 | "language": "java", 10 | "repo": "googleapis/java-pubsublite", 11 | "repo_short": "java-pubsublite", 12 | "distribution_name": "com.google.cloud:google-cloud-pubsublite", 13 | "api_id": "pubsublite.googleapis.com", 14 | "library_type": "GAPIC_COMBO", 15 | "requires_billing": true, 16 | "codeowner_team": "@googleapis/api-pubsublite", 17 | "recommended_package": "com.google.cloud.pubsublite.cloudpubsub", 18 | "min_java_version": 8 19 | } -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). 4 | 5 | The Google Security Team will respond within 5 working days of your report on g.co/vulnz. 6 | 7 | We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. 8 | -------------------------------------------------------------------------------- /codecov.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | codecov: 3 | ci: 4 | - source.cloud.google.com 5 | -------------------------------------------------------------------------------- /generation_config.yaml: -------------------------------------------------------------------------------- 1 | gapic_generator_version: 2.59.0 2 | googleapis_commitish: 4c2be914d36599e4db46e2d77d02f3f00665cc89 3 | libraries_bom_version: 26.61.0 4 | libraries: 5 | - api_shortname: pubsublite 6 | name_pretty: Cloud Pub/Sub Lite 7 | product_documentation: https://cloud.google.com/pubsub/lite/docs 8 | api_description: is designed to provide reliable, many-to-many, asynchronous messaging between applications. Publisher\napplications can send messages to a topic and other applications can\nsubscribe to that topic to receive the messages. By decoupling senders and\nreceivers, Google Cloud Pub/Sub allows developers to communicate between\nindependently written applications.\n\nCompared to Google Pub/Sub, Pub/Sub Lite provides partitioned zonal data\nstorage with predefined capacity. Both products present a similar API, but\nPub/Sub Lite has more usage caveats.\n\nSee the [Google Pub/Sub Lite docs](https://cloud.google.com/pubsub/quickstart-console#before-you-begin) for more details on how to activate\nPub/Sub Lite for your project, as well as guidance on how to choose between\nCloud Pub/Sub and Pub/Sub Lite. 9 | client_documentation: https://cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/history 10 | release_level: stable 11 | transport: grpc 12 | requires_billing: true 13 | language: java 14 | min_java_version: 8 15 | repo: googleapis/java-pubsublite 16 | repo_short: java-pubsublite 17 | distribution_name: com.google.cloud:google-cloud-pubsublite 18 | codeowner_team: '@googleapis/api-pubsublite' 19 | library_type: GAPIC_COMBO 20 | api_id: pubsublite.googleapis.com 21 | recommended_package: com.google.cloud.pubsublite.cloudpubsub 22 | GAPICs: 23 | - proto_path: google/cloud/pubsublite/v1 24 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/EnableAutoValue.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/googleapis/java-pubsublite/b9af4ce5597f40fc2e88f3b90b9ee3b4637a30f7/google-cloud-pubsublite/EnableAutoValue.txt -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/BacklogLocation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | /** BacklogLocation refers to a location with respect to the message backlog. */ 20 | public enum BacklogLocation { 21 | /** BEGINNING refers to the location of the oldest retained message. */ 22 | BEGINNING, 23 | /** 24 | * END refers to the location past all currently published messages, skipping the entire message 25 | * backlog. 26 | */ 27 | END 28 | } 29 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/CloudRegion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import com.google.api.gax.rpc.ApiException; 20 | import com.google.api.gax.rpc.StatusCode.Code; 21 | import com.google.auto.value.AutoValue; 22 | import com.google.cloud.pubsublite.internal.CheckedApiException; 23 | import java.io.Serializable; 24 | 25 | /** A wrapped string representing a Google Cloud region. */ 26 | @AutoValue 27 | public abstract class CloudRegion implements Serializable { 28 | private static final long serialVersionUID = 6814654654L; 29 | 30 | /** Construct a CloudRegion from a string. */ 31 | public static CloudRegion of(String value) throws ApiException { 32 | String[] splits = value.split("-", -1); 33 | if (splits.length != 2) { 34 | throw new CheckedApiException("Invalid region name: " + value, Code.INVALID_ARGUMENT) 35 | .underlying; 36 | } 37 | return new AutoValue_CloudRegion(value); 38 | } 39 | 40 | /** The string representing this region. */ 41 | public abstract String value(); 42 | 43 | /** {@inheritDoc} */ 44 | @Override 45 | public String toString() { 46 | return value(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import com.google.api.gax.retrying.RetrySettings; 20 | import java.time.Duration; 21 | 22 | /** Useful general constants for Pub/Sub Lite. */ 23 | public class Constants { 24 | public static final RetrySettings DEFAULT_RETRY_SETTINGS = 25 | RetrySettings.newBuilder() 26 | .setInitialRetryDelayDuration(Duration.ofMillis(100)) 27 | .setRetryDelayMultiplier(1.3) 28 | .setMaxRetryDelayDuration(Duration.ofSeconds(60)) 29 | .setJittered(true) 30 | .setTotalTimeoutDuration(Duration.ofMinutes(10)) 31 | .build(); 32 | 33 | public static final long MAX_PUBLISH_BATCH_COUNT = 1_000; 34 | public static final long MAX_PUBLISH_BATCH_BYTES = 1024 * 1024 * 7 / 2; // 3.5 MiB 35 | 36 | private Constants() {} 37 | } 38 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/Endpoints.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | /** Constructs regional endpoints from a CloudRegion. */ 20 | public final class Endpoints { 21 | /** Construct a regional endpoint from a CloudRegion. */ 22 | public static String regionalEndpoint(CloudRegion region) { 23 | return region.value() + "-pubsublite.googleapis.com:443"; 24 | } 25 | 26 | private Endpoints() {} 27 | } 28 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/ErrorCodes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import com.google.api.gax.rpc.StatusCode.Code; 20 | import com.google.common.collect.ImmutableSet; 21 | 22 | /** Pub/Sub Lite retryable error codes. */ 23 | public final class ErrorCodes { 24 | public static final ImmutableSet STREAM_RETRYABLE_CODES = 25 | ImmutableSet.of( 26 | Code.DEADLINE_EXCEEDED, 27 | Code.ABORTED, 28 | Code.INTERNAL, 29 | Code.UNAVAILABLE, 30 | Code.UNKNOWN, 31 | Code.RESOURCE_EXHAUSTED, 32 | Code.CANCELLED); 33 | 34 | public static boolean IsRetryableForStreams(Code code) { 35 | return STREAM_RETRYABLE_CODES.contains(code); 36 | } 37 | 38 | private ErrorCodes() {} 39 | } 40 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/MessageTransformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import com.google.api.gax.rpc.ApiException; 20 | 21 | /** 22 | * A MessageTransformer details how to transform a message of one type to another. It is likely that 23 | * either FromT or ToT will be a Message on publish and SequencedMessage on subscribe. 24 | */ 25 | public interface MessageTransformer { 26 | /** Transform one message type to another. */ 27 | ToT transform(FromT from) throws ApiException; 28 | } 29 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/Offset.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import com.google.auto.value.AutoValue; 20 | import java.io.Serializable; 21 | 22 | /** An offset in the partition. */ 23 | @AutoValue 24 | public abstract class Offset implements Comparable, Serializable { 25 | /** Create an offset. */ 26 | public static Offset of(long offset) { 27 | return new AutoValue_Offset(offset); 28 | } 29 | 30 | /** The long value of this offset. */ 31 | public abstract long value(); 32 | 33 | /** {@inheritDoc} */ 34 | @Override 35 | public int compareTo(Offset o) { 36 | return Long.compare(value(), o.value()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/Partition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import static com.google.cloud.pubsublite.internal.UncheckedApiPreconditions.checkArgument; 20 | 21 | import com.google.api.gax.rpc.ApiException; 22 | import com.google.auto.value.AutoValue; 23 | import java.io.Serializable; 24 | 25 | /** A partition of a topic. */ 26 | @AutoValue 27 | public abstract class Partition implements Serializable { 28 | private static final long serialVersionUID = 7583927435022345L; 29 | 30 | /** Create a partition from its long value. */ 31 | public static Partition of(long partition) throws ApiException { 32 | checkArgument(partition >= 0, "Partitions are zero indexed."); 33 | return new AutoValue_Partition(partition); 34 | } 35 | 36 | /** The long value of this partition. */ 37 | public abstract long value(); 38 | } 39 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/ProjectBuilderHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | abstract class ProjectBuilderHelper> { 20 | public abstract Builder setProject(ProjectIdOrNumber project); 21 | 22 | public Builder setProject(ProjectId project) { 23 | return setProject(ProjectIdOrNumber.of(project)); 24 | } 25 | 26 | public Builder setProject(ProjectNumber project) { 27 | return setProject(ProjectIdOrNumber.of(project)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/ProjectId.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import static com.google.cloud.pubsublite.internal.UncheckedApiPreconditions.checkArgument; 20 | 21 | import com.google.api.gax.rpc.ApiException; 22 | import com.google.auto.value.AutoValue; 23 | import java.io.Serializable; 24 | 25 | @AutoValue 26 | public abstract class ProjectId implements Serializable { 27 | public abstract String value(); 28 | 29 | @Override 30 | public String toString() { 31 | return value(); 32 | } 33 | 34 | public static ProjectId of(String value) throws ApiException { 35 | checkArgument(!value.isEmpty()); 36 | return new AutoValue_ProjectId(value); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/ProjectIdOrNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import com.google.auto.value.AutoOneOf; 20 | import java.io.Serializable; 21 | 22 | @AutoOneOf(ProjectIdOrNumber.Kind.class) 23 | public abstract class ProjectIdOrNumber implements Serializable { 24 | enum Kind { 25 | NAME, 26 | NUMBER 27 | } 28 | 29 | public abstract Kind getKind(); 30 | 31 | public abstract ProjectId name(); 32 | 33 | public abstract ProjectNumber number(); 34 | 35 | public static ProjectIdOrNumber of(ProjectId name) { 36 | return AutoOneOf_ProjectIdOrNumber.name(name); 37 | } 38 | 39 | public static ProjectIdOrNumber of(ProjectNumber number) { 40 | return AutoOneOf_ProjectIdOrNumber.number(number); 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | switch (getKind()) { 46 | case NAME: 47 | return name().toString(); 48 | case NUMBER: 49 | return number().toString(); 50 | default: 51 | throw new RuntimeException("Unknown case for ProjectIdOrNumber."); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/ProjectLocationBuilderHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | abstract class ProjectLocationBuilderHelper> 20 | extends ProjectBuilderHelper { 21 | public abstract Builder setLocation(CloudRegionOrZone location); 22 | 23 | public Builder setLocation(CloudRegion region) { 24 | return setLocation(CloudRegionOrZone.of(region)); 25 | } 26 | 27 | public Builder setLocation(CloudZone zone) { 28 | return setLocation(CloudRegionOrZone.of(zone)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/ProjectNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import static com.google.cloud.pubsublite.internal.UncheckedApiPreconditions.checkArgument; 20 | 21 | import com.google.api.gax.rpc.ApiException; 22 | import com.google.auto.value.AutoValue; 23 | import java.io.Serializable; 24 | 25 | /** 26 | * A wrapper class for the project 28 | * number. 29 | */ 30 | @AutoValue 31 | public abstract class ProjectNumber implements Serializable { 32 | /** The long value of this project number. */ 33 | public abstract long value(); 34 | 35 | @Override 36 | public String toString() { 37 | return Long.toString(value()); 38 | } 39 | 40 | /** Construct a ProjectNumber from its long value. */ 41 | public static ProjectNumber of(long value) throws ApiException { 42 | checkArgument(value > 0); 43 | return new AutoValue_ProjectNumber(value); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/ReservationName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import static com.google.cloud.pubsublite.internal.UncheckedApiPreconditions.checkArgument; 20 | 21 | import com.google.api.gax.rpc.ApiException; 22 | import com.google.auto.value.AutoValue; 23 | import java.io.Serializable; 24 | 25 | /** A string wrapper for the name of a reservation. */ 26 | @AutoValue 27 | public abstract class ReservationName implements Serializable { 28 | public abstract String value(); 29 | 30 | @Override 31 | public String toString() { 32 | return value(); 33 | } 34 | 35 | public static ReservationName of(String value) throws ApiException { 36 | checkArgument(!value.isEmpty()); 37 | return new AutoValue_ReservationName(value); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/SeekTarget.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import com.google.auto.value.AutoOneOf; 20 | import com.google.protobuf.Timestamp; 21 | import java.io.Serializable; 22 | 23 | /** The target location to seek a subscription to. */ 24 | @AutoOneOf(SeekTarget.Kind.class) 25 | public abstract class SeekTarget implements Serializable { 26 | public enum Kind { 27 | BACKLOG_LOCATION, 28 | PUBLISH_TIME, 29 | EVENT_TIME, 30 | } 31 | 32 | public abstract SeekTarget.Kind getKind(); 33 | 34 | public abstract BacklogLocation backlogLocation(); 35 | 36 | public abstract Timestamp publishTime(); 37 | 38 | public abstract Timestamp eventTime(); 39 | 40 | /** Seek to a named backlog location. */ 41 | public static SeekTarget of(BacklogLocation location) { 42 | return AutoOneOf_SeekTarget.backlogLocation(location); 43 | } 44 | 45 | /** Seek to a message publish timestamp. */ 46 | public static SeekTarget ofPublishTime(Timestamp time) { 47 | return AutoOneOf_SeekTarget.publishTime(time); 48 | } 49 | 50 | /** Seek to a message event timestamp. */ 51 | public static SeekTarget ofEventTime(Timestamp time) { 52 | return AutoOneOf_SeekTarget.eventTime(time); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/SubscriptionName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import static com.google.cloud.pubsublite.internal.UncheckedApiPreconditions.checkArgument; 20 | 21 | import com.google.api.gax.rpc.ApiException; 22 | import com.google.auto.value.AutoValue; 23 | import java.io.Serializable; 24 | 25 | /** A string wrapper for the name of a subscription. */ 26 | @AutoValue 27 | public abstract class SubscriptionName implements Serializable { 28 | public abstract String value(); 29 | 30 | @Override 31 | public String toString() { 32 | return value(); 33 | } 34 | 35 | public static SubscriptionName of(String value) throws ApiException { 36 | checkArgument(!value.isEmpty()); 37 | return new AutoValue_SubscriptionName(value); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/TopicName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import static com.google.cloud.pubsublite.internal.UncheckedApiPreconditions.checkArgument; 20 | 21 | import com.google.api.gax.rpc.ApiException; 22 | import com.google.auto.value.AutoValue; 23 | import java.io.Serializable; 24 | 25 | /** A string wrapper for the name of a topic. */ 26 | @AutoValue 27 | public abstract class TopicName implements Serializable { 28 | public abstract String value(); 29 | 30 | @Override 31 | public String toString() { 32 | return value(); 33 | } 34 | 35 | public static TopicName of(String value) throws ApiException { 36 | checkArgument(!value.isEmpty()); 37 | return new AutoValue_TopicName(value); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/cloudpubsub/KeyExtractor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.cloudpubsub; 18 | 19 | import com.google.api.gax.rpc.ApiException; 20 | import com.google.protobuf.ByteString; 21 | import com.google.pubsub.v1.PubsubMessage; 22 | 23 | /** 24 | * A KeyExtractor can extract the Pub/Sub Lite 'key' field used for message routing from a 25 | * PubsubMessage. It will by default use the ordering_key field directly for this if it exists. 26 | * 27 | *

An empty ByteString implies that the message should have no ordering key. 28 | */ 29 | public interface KeyExtractor { 30 | /** An extractor that gets the routing key from the ordering key field. */ 31 | KeyExtractor DEFAULT = PubsubMessage::getOrderingKeyBytes; 32 | 33 | /** Extract the ByteString routing key from a PubsubMessage. */ 34 | ByteString extractKey(PubsubMessage message) throws ApiException; 35 | } 36 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/cloudpubsub/NackHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.cloudpubsub; 18 | 19 | import com.google.api.core.ApiFuture; 20 | import com.google.api.core.ApiFutures; 21 | import com.google.api.gax.rpc.StatusCode.Code; 22 | import com.google.cloud.pubsublite.internal.CheckedApiException; 23 | import com.google.pubsub.v1.PubsubMessage; 24 | 25 | /** 26 | * A NackHandler handles when nack() is called in a user's AckReplyConsumer. Pub/Sub Lite does not 27 | * have a concept of 'nack'. When nack() is called in an AckReplyConsumerr, nack(message) is called 28 | * with the nacked message. 29 | * 30 | *

If the returned future is successful, the message is acknowledged. If the future fails, the 31 | * subscriber client will be failed. The default behavior is to immediately fail the client. 32 | */ 33 | public interface NackHandler { 34 | default ApiFuture nack(PubsubMessage message) { 35 | return ApiFutures.immediateFailedFuture( 36 | new CheckedApiException( 37 | "You may not nack messages by default when using a PubSub Lite client. See" 38 | + " NackHandler for how to customize this.", 39 | Code.UNIMPLEMENTED) 40 | .underlying); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/cloudpubsub/PartitionSubscriberClientSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.cloudpubsub; 18 | 19 | import com.google.cloud.pubsublite.Partition; 20 | import com.google.cloud.pubsublite.SubscriptionPath; 21 | import com.google.cloud.pubsublite.v1.SubscriberServiceClient; 22 | 23 | /** Supplies new SubscriberServiceClient instances. */ 24 | public interface PartitionSubscriberClientSupplier { 25 | /** Creates a new SubscriberServiceClient for the specified subscription and partition. */ 26 | SubscriberServiceClient get(SubscriptionPath subscription, Partition partition); 27 | } 28 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/cloudpubsub/Publisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.cloudpubsub; 18 | 19 | import com.google.api.core.ApiService; 20 | import com.google.api.gax.rpc.ApiException; 21 | import com.google.cloud.pubsub.v1.PublisherInterface; 22 | 23 | /** Pub/Sub Lite publishers are streaming based and can experience permanent errors. */ 24 | public interface Publisher extends PublisherInterface, ApiService { 25 | /** Create a new Pub/Sub Lite publisher using the provided settings. */ 26 | static Publisher create(PublisherSettings settings) throws ApiException { 27 | return settings.instantiate(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/cloudpubsub/Subscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.cloudpubsub; 18 | 19 | import com.google.api.gax.rpc.ApiException; 20 | import com.google.cloud.pubsub.v1.SubscriberInterface; 21 | 22 | /** A sub-interface of {@link com.google.cloud.pubsub.v1.SubscriberInterface}. */ 23 | public interface Subscriber extends SubscriberInterface { 24 | /** Create a new Pub/Sub Lite subscriber using the provided settings. */ 25 | static Subscriber create(SubscriberSettings settings) throws ApiException { 26 | return settings.instantiate(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/cloudpubsub/internal/AckSetTracker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.cloudpubsub.internal; 18 | 19 | import com.google.api.core.ApiService; 20 | import com.google.cloud.pubsublite.SequencedMessage; 21 | import com.google.cloud.pubsublite.internal.CheckedApiException; 22 | 23 | interface AckSetTracker extends ApiService { 24 | // Track the given message. Returns a Runnable to ack this message if the message is a valid one 25 | // to add to the ack set. Must be called with strictly increasing offset messages. 26 | Runnable track(SequencedMessage message) throws CheckedApiException; 27 | 28 | // Discard all outstanding acks and wait for any pending commit offset to be acknowledged by the 29 | // server. Throws an exception if the committer shut down due to a permanent error. 30 | void waitUntilCommitted() throws CheckedApiException; 31 | } 32 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/cloudpubsub/internal/MultiPartitionSubscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.cloudpubsub.internal; 18 | 19 | import com.google.api.core.ApiService; 20 | import com.google.api.gax.rpc.ApiException; 21 | import com.google.cloud.pubsublite.cloudpubsub.Subscriber; 22 | import com.google.cloud.pubsublite.internal.ProxyService; 23 | import java.util.List; 24 | 25 | // A MultiPartitionSubscriber wraps multiple subscribers into a single ApiService that can be 26 | // interacted with. If any single subscriber fails, all others are stopped. 27 | public class MultiPartitionSubscriber extends ProxyService implements Subscriber { 28 | public static Subscriber of(List services) throws ApiException { 29 | return new MultiPartitionSubscriber(services); 30 | } 31 | 32 | private MultiPartitionSubscriber(List subscribers) throws ApiException { 33 | super(subscribers); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/cloudpubsub/internal/PartitionSubscriberFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.cloudpubsub.internal; 18 | 19 | import com.google.cloud.pubsublite.Partition; 20 | import com.google.cloud.pubsublite.cloudpubsub.Subscriber; 21 | import com.google.cloud.pubsublite.internal.CheckedApiException; 22 | 23 | /** 24 | * PartitionSubscriberFactories are used dynamically in a context where there is no client downcall. 25 | * Therefore, their factory method throws a checked exception. 26 | */ 27 | public interface PartitionSubscriberFactory extends AutoCloseable { 28 | Subscriber newSubscriber(Partition partition) throws CheckedApiException; 29 | 30 | void close(); 31 | } 32 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/cloudpubsub/internal/ResettableSubscriberFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.cloudpubsub.internal; 18 | 19 | import com.google.api.gax.rpc.ApiException; 20 | import com.google.cloud.pubsublite.internal.wire.Subscriber; 21 | import com.google.cloud.pubsublite.internal.wire.SubscriberResetHandler; 22 | import com.google.cloud.pubsublite.proto.SequencedMessage; 23 | import java.io.Serializable; 24 | import java.util.List; 25 | import java.util.function.Consumer; 26 | 27 | public interface ResettableSubscriberFactory extends Serializable { 28 | Subscriber newSubscriber( 29 | Consumer> messageConsumer, SubscriberResetHandler resetHandler) 30 | throws ApiException; 31 | } 32 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/AlarmFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.google.cloud.pubsublite.internal; 17 | 18 | import static java.util.concurrent.TimeUnit.NANOSECONDS; 19 | 20 | import com.google.cloud.pubsublite.internal.wire.SystemExecutors; 21 | import com.google.common.flogger.GoogleLogger; 22 | import java.time.Duration; 23 | import java.util.concurrent.Future; 24 | 25 | // An alarm factory comes with a builtin delay and constructs a future which runs that delay after 26 | // it finishes. 27 | public interface AlarmFactory { 28 | Future newAlarm(Runnable runnable); 29 | 30 | // Get around lack of interface support for private static members in java 8 31 | final class Internal { 32 | private static final GoogleLogger LOGGER = GoogleLogger.forEnclosingClass(); 33 | } 34 | ; 35 | 36 | static AlarmFactory create(Duration duration) { 37 | return runnable -> 38 | SystemExecutors.getAlarmExecutor() 39 | .scheduleWithFixedDelay( 40 | () -> { 41 | try { 42 | runnable.run(); 43 | } catch (Throwable t) { 44 | Internal.LOGGER.atSevere().withCause(t).log("Alarm leaked exception."); 45 | } 46 | }, 47 | 0, 48 | duration.toNanos(), 49 | NANOSECONDS); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/ApiBackgroundResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal; 18 | 19 | import com.google.api.gax.core.BackgroundResource; 20 | import com.google.api.gax.rpc.ApiException; 21 | 22 | public interface ApiBackgroundResource extends BackgroundResource { 23 | /** 24 | * Tear down this resource. 25 | * 26 | * @throws ApiException on a failure to properly terminate. 27 | */ 28 | @Override 29 | void close() throws ApiException; 30 | } 31 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/BlockingPullSubscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal; 18 | 19 | import com.google.api.core.ApiFuture; 20 | import com.google.cloud.pubsublite.proto.SequencedMessage; 21 | import java.util.Optional; 22 | import javax.annotation.concurrent.ThreadSafe; 23 | 24 | @ThreadSafe 25 | public interface BlockingPullSubscriber extends AutoCloseable { 26 | 27 | /** 28 | * Returns a {@link ApiFuture} that will be completed when there are messages available. 29 | * Unfinished existing {@link ApiFuture} returned by onData() will be abandoned and superseded by 30 | * new onData() call. 31 | * 32 | *

{@link CheckedApiException} will be set to the Future if there is underlying permanent 33 | * error. 34 | */ 35 | ApiFuture onData(); 36 | 37 | /** 38 | * Pull messages if there is any ready to deliver. Any message will only be delivered to one call 39 | * if there are multiple concurrent calls. 40 | * 41 | * @throws CheckedApiException if there is underlying permanent error. 42 | */ 43 | Optional messageIfAvailable() throws CheckedApiException; 44 | 45 | void close(); 46 | } 47 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/Lazy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal; 18 | 19 | import java.util.function.Supplier; 20 | import javax.annotation.Nullable; 21 | import javax.annotation.concurrent.GuardedBy; 22 | 23 | /** A thread-safe, lazily constructed instance of an object. */ 24 | public class Lazy { 25 | @GuardedBy("this") 26 | private @Nullable T instance = null; 27 | 28 | private final Supplier supplier; 29 | 30 | public Lazy(Supplier supplier) { 31 | this.supplier = supplier; 32 | } 33 | 34 | public synchronized T get() { 35 | if (instance == null) instance = supplier.get(); 36 | return instance; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/MoreApiFutures.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal; 18 | 19 | import com.google.api.core.ApiFuture; 20 | import com.google.api.core.ApiFutureCallback; 21 | import com.google.api.core.ApiFutures; 22 | import com.google.api.core.SettableApiFuture; 23 | import com.google.cloud.pubsublite.internal.wire.SystemExecutors; 24 | 25 | public final class MoreApiFutures { 26 | private MoreApiFutures() {} 27 | 28 | public static void connectFutures( 29 | ApiFuture source, SettableApiFuture toConnect) { 30 | ApiFutures.addCallback( 31 | source, 32 | new ApiFutureCallback() { 33 | @Override 34 | public void onFailure(Throwable throwable) { 35 | toConnect.setException(throwable); 36 | } 37 | 38 | @Override 39 | public void onSuccess(T t) { 40 | toConnect.set(t); 41 | } 42 | }, 43 | SystemExecutors.getFuturesExecutor()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/PublishSequenceNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal; 18 | 19 | import com.google.auto.value.AutoValue; 20 | import java.io.Serializable; 21 | 22 | /** A sequence number for a published message, for implementing publish idempotency. */ 23 | @AutoValue 24 | public abstract class PublishSequenceNumber implements Serializable { 25 | 26 | /** Create a publish sequence number from its long value. */ 27 | public static PublishSequenceNumber of(long sequenceNumber) { 28 | return new AutoValue_PublishSequenceNumber(sequenceNumber); 29 | } 30 | 31 | /** The sequence number that should be set for the first message in a publisher session. */ 32 | public static final PublishSequenceNumber FIRST = PublishSequenceNumber.of(0); 33 | 34 | /** Returns the next sequence number that follows the current. */ 35 | public PublishSequenceNumber next() { 36 | return PublishSequenceNumber.of(value() + 1); 37 | } 38 | 39 | /** The long value of this publish sequence number. */ 40 | public abstract long value(); 41 | } 42 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/Publisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal; 18 | 19 | import com.google.api.core.ApiFuture; 20 | import com.google.api.core.ApiService; 21 | import com.google.cloud.pubsublite.proto.PubSubMessage; 22 | import java.io.Flushable; 23 | 24 | /** A generic PubSub Lite publisher. Errors are handled out of band. Thread safe. */ 25 | public interface Publisher extends ApiService, Flushable { 26 | // Publish a new message. Behavior is undefined if a call to flush() is outstanding or close() has 27 | // already been called. This method never blocks. 28 | // 29 | // Guarantees that if a single publish future has an exception set, all publish calls made after 30 | // that will also have an exception set. 31 | ApiFuture publish(PubSubMessage message); 32 | 33 | // Attempts to cancel all outstanding publishes. 34 | void cancelOutstandingPublishes(); 35 | } 36 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/PullSubscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal; 18 | 19 | import com.google.cloud.pubsublite.Offset; 20 | import java.util.List; 21 | import java.util.Optional; 22 | 23 | // A PullSubscriber exposes a "pull" mechanism for retrieving messages. 24 | public interface PullSubscriber extends AutoCloseable { 25 | // Pull currently available messages from this subscriber. Does not block. 26 | List pull() throws CheckedApiException; 27 | 28 | // The next offset expected to be returned by this PullSubscriber, or empty if unknown. 29 | // Subsequent messages are guaranteed to have offsets of at least this value. 30 | Optional nextOffset(); 31 | } 32 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/RoutingPolicy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal; 18 | 19 | import com.google.cloud.pubsublite.Partition; 20 | import com.google.cloud.pubsublite.proto.PubSubMessage; 21 | 22 | // Route the user message key to a given partition. 23 | public interface RoutingPolicy { 24 | interface Factory { 25 | RoutingPolicy newPolicy(long numPartitions); 26 | } 27 | 28 | // Route a message to a partition. 29 | Partition route(PubSubMessage messageKey) throws CheckedApiException; 30 | } 31 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/SequencedPublisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal; 18 | 19 | import com.google.api.core.ApiFuture; 20 | import com.google.api.core.ApiService; 21 | import com.google.cloud.pubsublite.proto.PubSubMessage; 22 | import java.io.Flushable; 23 | 24 | /** 25 | * A PubSub Lite publisher that requires a sequence number assigned to every message, for publish 26 | * idempotency. Errors are handled out of band. Thread safe. 27 | */ 28 | public interface SequencedPublisher extends ApiService, Flushable { 29 | /** 30 | * Publish a new message with an assigned sequence number. 31 | * 32 | *

Behavior is undefined if a call to flush() is outstanding or close() has already been 33 | * called. This method never blocks. 34 | * 35 | *

Guarantees that if a single publish future has an exception set, all publish calls made 36 | * after that will also have an exception set. 37 | */ 38 | ApiFuture publish(PubSubMessage message, PublishSequenceNumber sequenceNumber); 39 | 40 | /** Attempts to cancel all outstanding publishes. */ 41 | void cancelOutstandingPublishes(); 42 | } 43 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/UncheckedApiPreconditions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal; 18 | 19 | import com.google.api.gax.rpc.ApiException; 20 | 21 | // Reduce the boilerplate of precondition checking by throwing an ApiException. 22 | public class UncheckedApiPreconditions { 23 | private UncheckedApiPreconditions() {} 24 | 25 | public static void checkArgument(boolean test) throws ApiException { 26 | checkArgument(test, ""); 27 | } 28 | 29 | public static void checkArgument(boolean test, String description) throws ApiException { 30 | try { 31 | CheckedApiPreconditions.checkArgument(test, description); 32 | } catch (CheckedApiException e) { 33 | throw e.underlying; 34 | } 35 | } 36 | 37 | public static void checkState(boolean test) throws ApiException { 38 | checkState(test, ""); 39 | } 40 | 41 | public static void checkState(boolean test, String description) throws ApiException { 42 | try { 43 | CheckedApiPreconditions.checkState(test, description); 44 | } catch (CheckedApiException e) { 45 | throw e.underlying; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | @CheckReturnValue 18 | @ParametersAreNonnullByDefault 19 | package com.google.cloud.pubsublite.internal; 20 | 21 | import com.google.errorprone.annotations.CheckReturnValue; 22 | import javax.annotation.ParametersAreNonnullByDefault; 23 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/testing/FakeApiService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.testing; 18 | 19 | import com.google.api.core.AbstractApiService; 20 | 21 | /** 22 | * Fake Pub/Sub Lite service for testing. Used like: 23 | * 24 | *

25 |  * static abstract class SubscriberFakeService extends FakeApiService implements Subscriber {};
26 |  * @Spy private SubscriberFakeService wireSubscriber;
27 |  * 
28 | */ 29 | public abstract class FakeApiService extends AbstractApiService { 30 | public void fail(Throwable t) { 31 | notifyFailed(t); 32 | } 33 | 34 | @Override 35 | protected void doStart() { 36 | notifyStarted(); 37 | } 38 | 39 | @Override 40 | protected void doStop() { 41 | notifyStopped(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/testing/TestResetSignal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.testing; 18 | 19 | import com.google.api.gax.rpc.StatusCode.Code; 20 | import com.google.cloud.pubsublite.internal.CheckedApiException; 21 | import com.google.protobuf.Any; 22 | import com.google.rpc.ErrorInfo; 23 | import com.google.rpc.Status; 24 | import io.grpc.protobuf.StatusProto; 25 | 26 | public final class TestResetSignal { 27 | public static CheckedApiException newCheckedException() { 28 | ErrorInfo errorInfo = 29 | ErrorInfo.newBuilder().setReason("RESET").setDomain("pubsublite.googleapis.com").build(); 30 | Status status = 31 | Status.newBuilder().setCode(Code.ABORTED.ordinal()).addDetails(Any.pack(errorInfo)).build(); 32 | return new CheckedApiException(StatusProto.toStatusRuntimeException(status), Code.ABORTED); 33 | } 34 | 35 | private TestResetSignal() {} 36 | } 37 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/ApiExceptionCommitter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import static com.google.cloud.pubsublite.internal.ExtractStatus.toClientFuture; 20 | 21 | import com.google.api.core.ApiFuture; 22 | import com.google.api.gax.rpc.ApiException; 23 | import com.google.cloud.pubsublite.Offset; 24 | import com.google.cloud.pubsublite.internal.CheckedApiException; 25 | import com.google.cloud.pubsublite.internal.ProxyService; 26 | 27 | class ApiExceptionCommitter extends ProxyService implements Committer { 28 | private final Committer committer; 29 | 30 | ApiExceptionCommitter(Committer committer) throws ApiException { 31 | super(committer); 32 | this.committer = committer; 33 | } 34 | 35 | @Override 36 | public ApiFuture commitOffset(Offset offset) { 37 | return toClientFuture(committer.commitOffset(offset)); 38 | } 39 | 40 | @Override 41 | public void waitUntilEmpty() throws CheckedApiException { 42 | committer.waitUntilEmpty(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/ApiExceptionPublisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import static com.google.cloud.pubsublite.internal.ExtractStatus.toClientFuture; 20 | 21 | import com.google.api.core.ApiFuture; 22 | import com.google.api.gax.rpc.ApiException; 23 | import com.google.cloud.pubsublite.internal.ProxyService; 24 | import com.google.cloud.pubsublite.internal.Publisher; 25 | import com.google.cloud.pubsublite.proto.PubSubMessage; 26 | import java.io.IOException; 27 | 28 | public class ApiExceptionPublisher extends ProxyService implements Publisher { 29 | private final Publisher publisher; 30 | 31 | ApiExceptionPublisher(Publisher publisher) throws ApiException { 32 | super(publisher); 33 | this.publisher = publisher; 34 | } 35 | 36 | @Override 37 | public ApiFuture publish(PubSubMessage message) { 38 | return toClientFuture(publisher.publish(message)); 39 | } 40 | 41 | @Override 42 | public void cancelOutstandingPublishes() { 43 | publisher.cancelOutstandingPublishes(); 44 | } 45 | 46 | @Override 47 | public void flush() throws IOException { 48 | publisher.flush(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/Assigner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.api.core.ApiService; 20 | 21 | /** An Assigner is responsible for handling partition assignments for a subscribing client. */ 22 | public interface Assigner extends ApiService {} 23 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/AssignerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.api.gax.rpc.ApiException; 20 | 21 | public interface AssignerFactory { 22 | Assigner New(PartitionAssignmentReceiver receiver) throws ApiException; 23 | } 24 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/BatchPublisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.internal.PublishSequenceNumber; 20 | import com.google.cloud.pubsublite.proto.PubSubMessage; 21 | import java.util.Collection; 22 | 23 | interface BatchPublisher extends AutoCloseable { 24 | /** 25 | * Publish the batch of messages, with the given sequence number of the first message in the 26 | * batch. Failures are communicated out of band. 27 | */ 28 | void publish(Collection messages, PublishSequenceNumber firstSequenceNumber); 29 | } 30 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/BatchPublisherFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.proto.MessagePublishResponse; 20 | import com.google.cloud.pubsublite.proto.PublishRequest; 21 | import com.google.cloud.pubsublite.proto.PublishResponse; 22 | 23 | interface BatchPublisherFactory 24 | extends SingleConnectionFactory< 25 | PublishRequest, PublishResponse, MessagePublishResponse, BatchPublisher> {} 26 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/Committer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.api.core.ApiFuture; 20 | import com.google.api.core.ApiService; 21 | import com.google.cloud.pubsublite.Offset; 22 | import com.google.cloud.pubsublite.internal.CheckedApiException; 23 | 24 | public interface Committer extends ApiService { 25 | // Commit a given offset. Clean shutdown waits for all outstanding commits to complete. 26 | ApiFuture commitOffset(Offset offset); 27 | 28 | // Waits until all commits have been sent and acknowledged by the server. Throws an exception if 29 | // the committer shut down due to a permanent error. 30 | void waitUntilEmpty() throws CheckedApiException; 31 | } 32 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/ConnectedAssigner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | public interface ConnectedAssigner extends AutoCloseable { 20 | // Acknowledge an outstanding assignment. 21 | void ack(); 22 | } 23 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/ConnectedAssignerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.proto.PartitionAssignment; 20 | import com.google.cloud.pubsublite.proto.PartitionAssignmentRequest; 21 | 22 | interface ConnectedAssignerFactory 23 | extends SingleConnectionFactory< 24 | PartitionAssignmentRequest, PartitionAssignment, PartitionAssignment, ConnectedAssigner> {} 25 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/ConnectedCommitter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.Offset; 20 | 21 | interface ConnectedCommitter extends AutoCloseable { 22 | // Commit the given offset. Responses are handled out of band. 23 | void commit(Offset offset); 24 | } 25 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/ConnectedCommitterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.proto.SequencedCommitCursorResponse; 20 | import com.google.cloud.pubsublite.proto.StreamingCommitCursorRequest; 21 | import com.google.cloud.pubsublite.proto.StreamingCommitCursorResponse; 22 | 23 | interface ConnectedCommitterFactory 24 | extends SingleConnectionFactory< 25 | StreamingCommitCursorRequest, 26 | StreamingCommitCursorResponse, 27 | SequencedCommitCursorResponse, 28 | ConnectedCommitter> {} 29 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/ConnectedSubscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.proto.FlowControlRequest; 20 | 21 | interface ConnectedSubscriber extends AutoCloseable { 22 | void allowFlow(FlowControlRequest request); 23 | } 24 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/ConnectedSubscriberFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.proto.SequencedMessage; 20 | import com.google.cloud.pubsublite.proto.SubscribeRequest; 21 | import com.google.cloud.pubsublite.proto.SubscribeResponse; 22 | import java.util.List; 23 | 24 | interface ConnectedSubscriberFactory 25 | extends SingleConnectionFactory< 26 | SubscribeRequest, SubscribeResponse, List, ConnectedSubscriber> {} 27 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/PartitionAssignmentReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.Partition; 20 | import java.util.Set; 21 | 22 | /** 23 | * A receiver for partition assignments. All updates to reflect the assignment should be performed 24 | * inline. 25 | */ 26 | public interface PartitionAssignmentReceiver { 27 | void handleAssignment(Set assignment); 28 | } 29 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.google.cloud.pubsublite.internal.wire; 17 | 18 | import com.google.api.core.ApiService; 19 | import java.util.function.Consumer; 20 | 21 | public interface PartitionCountWatcher extends ApiService { 22 | interface Factory { 23 | PartitionCountWatcher newWatcher(Consumer receiver); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/PartitionPublisherFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.api.gax.rpc.ApiException; 20 | import com.google.cloud.pubsublite.MessageMetadata; 21 | import com.google.cloud.pubsublite.Partition; 22 | import com.google.cloud.pubsublite.internal.Publisher; 23 | 24 | public interface PartitionPublisherFactory extends AutoCloseable { 25 | Publisher newPublisher(Partition partition) throws ApiException; 26 | 27 | void close(); 28 | } 29 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/Predicates.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.proto.SequencedMessage; 20 | import com.google.common.collect.Ordering; 21 | import java.util.Comparator; 22 | 23 | public final class Predicates { 24 | public static boolean isOrdered(Iterable messages) { 25 | return Ordering.from( 26 | Comparator.comparingLong((SequencedMessage m) -> m.getCursor().getOffset())) 27 | .isStrictlyOrdered(messages); 28 | } 29 | 30 | private Predicates() {} 31 | } 32 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/ResetSignal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.ErrorCodes; 20 | import com.google.cloud.pubsublite.internal.CheckedApiException; 21 | import com.google.cloud.pubsublite.internal.ExtractStatus; 22 | 23 | // Pub/Sub Lite's stream RESET signal is sent by the server to instruct the client to reset the 24 | // stream state. 25 | public final class ResetSignal { 26 | private static final String REASON = "RESET"; 27 | 28 | public static boolean isResetSignal(CheckedApiException checkedApiException) { 29 | if (!ErrorCodes.IsRetryableForStreams(checkedApiException.code())) { 30 | return false; 31 | } 32 | return ExtractStatus.getErrorInfoReason(checkedApiException).equals(REASON); 33 | } 34 | 35 | private ResetSignal() {} 36 | } 37 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/RetryingConnection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.api.core.ApiService; 20 | import com.google.cloud.pubsublite.internal.CheckedApiException; 21 | import java.util.Optional; 22 | 23 | interface RetryingConnection extends ApiService { 24 | // Reinitialize the stream. Must be called in a downcall to prevent deadlock. 25 | void reinitialize(StreamRequestT initialRequest); 26 | 27 | interface Modifier { 28 | void modify(Optional connectionOr) throws CheckedApiException; 29 | } 30 | 31 | // Run modification on the current connection or empty if not connected. 32 | void modifyConnection(Modifier modifier) throws CheckedApiException; 33 | } 34 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/RetryingConnectionObserver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.internal.CheckedApiException; 20 | 21 | public interface RetryingConnectionObserver { 22 | // Trigger reinitialization. This cannot be an upcall. It needs to be atomic so there is no 23 | // possibility for other client messages to be sent on the stream between the new stream being 24 | // created and the client initialization occurring. It cannot be called with connectionMonitor 25 | // held since all locks need to be acquired in concrete then abstract class order to avoid 26 | // deadlocks. 27 | // 28 | // `streamError` is the error that caused the connection to break. 29 | void triggerReinitialize(CheckedApiException streamError); 30 | 31 | void onClientResponse(ClientResponseT value) throws CheckedApiException; 32 | } 33 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/SingleConnectionFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.api.gax.rpc.ResponseObserver; 20 | 21 | public interface SingleConnectionFactory< 22 | StreamRequestT, StreamResponseT, ClientResponseT, ConnectionT extends AutoCloseable> { 23 | ConnectionT New( 24 | StreamFactory streamFactory, 25 | ResponseObserver clientStream, 26 | StreamRequestT initialRequest); 27 | } 28 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/StreamFactories.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.proto.PublishRequest; 20 | import com.google.cloud.pubsublite.proto.PublishResponse; 21 | import com.google.cloud.pubsublite.proto.StreamingCommitCursorRequest; 22 | import com.google.cloud.pubsublite.proto.StreamingCommitCursorResponse; 23 | import com.google.cloud.pubsublite.proto.SubscribeRequest; 24 | import com.google.cloud.pubsublite.proto.SubscribeResponse; 25 | 26 | public final class StreamFactories { 27 | public interface PublishStreamFactory extends StreamFactory {} 28 | 29 | public interface SubscribeStreamFactory 30 | extends StreamFactory {} 31 | 32 | public interface CursorStreamFactory 33 | extends StreamFactory {} 34 | } 35 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/StreamFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.api.gax.rpc.ClientStream; 20 | import com.google.api.gax.rpc.ResponseObserver; 21 | 22 | public interface StreamFactory { 23 | ClientStream New(ResponseObserver responseStream); 24 | } 25 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/Subscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.api.core.ApiService; 20 | import com.google.cloud.pubsublite.internal.CheckedApiException; 21 | import com.google.cloud.pubsublite.proto.FlowControlRequest; 22 | 23 | /** 24 | * A generic PubSub Lite subscriber. Errors are handled out of band. Messages are sent out of band. 25 | * Thread safe. 26 | */ 27 | public interface Subscriber extends ApiService { 28 | // Allow the provided amount of messages and bytes to be sent by the server. 29 | void allowFlow(FlowControlRequest request) throws CheckedApiException; 30 | } 31 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/SubscriberFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.api.gax.rpc.ApiException; 20 | import com.google.cloud.pubsublite.proto.SequencedMessage; 21 | import java.io.Serializable; 22 | import java.util.List; 23 | import java.util.function.Consumer; 24 | 25 | public interface SubscriberFactory extends Serializable { 26 | Subscriber newSubscriber(Consumer> messageConsumer) throws ApiException; 27 | } 28 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/SubscriberResetHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.cloud.pubsublite.internal.CheckedApiException; 20 | 21 | public interface SubscriberResetHandler { 22 | // Called when the server instructs the subscriber to reset its state in order to handle an out of 23 | // band seek. The implementation should return false if reset is not handled by this type of 24 | // subscriber client. If an exception is thrown, the subscriber is shut down. 25 | boolean handleReset() throws CheckedApiException; 26 | 27 | // Use SubscriberResetHandler::unhandled to disable reset handling. 28 | static boolean unhandled() { 29 | return false; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/UuidBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import com.google.protobuf.ByteString; 20 | import java.nio.ByteBuffer; 21 | import java.util.UUID; 22 | 23 | /** Utilities for generating and converting 128-bit UUIDs. */ 24 | public final class UuidBuilder { 25 | 26 | /** Generates a random UUID. */ 27 | public static UUID generate() { 28 | return UUID.randomUUID(); 29 | } 30 | 31 | /** Converts a UUID to a ByteString. */ 32 | public static ByteString toByteString(UUID uuid) { 33 | ByteBuffer uuidBuffer = ByteBuffer.allocate(16); 34 | uuidBuffer.putLong(uuid.getMostSignificantBits()); 35 | uuidBuffer.putLong(uuid.getLeastSignificantBits()); 36 | return ByteString.copyFrom(uuidBuffer.array()); 37 | } 38 | 39 | private UuidBuilder() {} 40 | } 41 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/wire/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | @CheckReturnValue 18 | @ParametersAreNonnullByDefault 19 | package com.google.cloud.pubsublite.internal.wire; 20 | 21 | import com.google.errorprone.annotations.CheckReturnValue; 22 | import javax.annotation.ParametersAreNonnullByDefault; 23 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | @CheckReturnValue 18 | @ParametersAreNonnullByDefault 19 | package com.google.cloud.pubsublite; 20 | 21 | import com.google.errorprone.annotations.CheckReturnValue; 22 | import javax.annotation.ParametersAreNonnullByDefault; 23 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/v1/stub/PartitionAssignmentServiceStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1.stub; 18 | 19 | import com.google.api.gax.core.BackgroundResource; 20 | import com.google.api.gax.rpc.BidiStreamingCallable; 21 | import com.google.cloud.pubsublite.proto.PartitionAssignment; 22 | import com.google.cloud.pubsublite.proto.PartitionAssignmentRequest; 23 | import javax.annotation.Generated; 24 | 25 | // AUTO-GENERATED DOCUMENTATION AND CLASS. 26 | /** 27 | * Base stub class for the PartitionAssignmentService service API. 28 | * 29 | *

This class is for advanced usage and reflects the underlying API directly. 30 | */ 31 | @Generated("by gapic-generator-java") 32 | public abstract class PartitionAssignmentServiceStub implements BackgroundResource { 33 | 34 | public BidiStreamingCallable 35 | assignPartitionsCallable() { 36 | throw new UnsupportedOperationException("Not implemented: assignPartitionsCallable()"); 37 | } 38 | 39 | @Override 40 | public abstract void close(); 41 | } 42 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/v1/stub/PublisherServiceStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1.stub; 18 | 19 | import com.google.api.gax.core.BackgroundResource; 20 | import com.google.api.gax.rpc.BidiStreamingCallable; 21 | import com.google.cloud.pubsublite.proto.PublishRequest; 22 | import com.google.cloud.pubsublite.proto.PublishResponse; 23 | import javax.annotation.Generated; 24 | 25 | // AUTO-GENERATED DOCUMENTATION AND CLASS. 26 | /** 27 | * Base stub class for the PublisherService service API. 28 | * 29 | *

This class is for advanced usage and reflects the underlying API directly. 30 | */ 31 | @Generated("by gapic-generator-java") 32 | public abstract class PublisherServiceStub implements BackgroundResource { 33 | 34 | public BidiStreamingCallable publishCallable() { 35 | throw new UnsupportedOperationException("Not implemented: publishCallable()"); 36 | } 37 | 38 | @Override 39 | public abstract void close(); 40 | } 41 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/main/java/com/google/cloud/pubsublite/v1/stub/SubscriberServiceStub.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1.stub; 18 | 19 | import com.google.api.gax.core.BackgroundResource; 20 | import com.google.api.gax.rpc.BidiStreamingCallable; 21 | import com.google.cloud.pubsublite.proto.SubscribeRequest; 22 | import com.google.cloud.pubsublite.proto.SubscribeResponse; 23 | import javax.annotation.Generated; 24 | 25 | // AUTO-GENERATED DOCUMENTATION AND CLASS. 26 | /** 27 | * Base stub class for the SubscriberService service API. 28 | * 29 | *

This class is for advanced usage and reflects the underlying API directly. 30 | */ 31 | @Generated("by gapic-generator-java") 32 | public abstract class SubscriberServiceStub implements BackgroundResource { 33 | 34 | public BidiStreamingCallable subscribeCallable() { 35 | throw new UnsupportedOperationException("Not implemented: subscribeCallable()"); 36 | } 37 | 38 | @Override 39 | public abstract void close(); 40 | } 41 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/MessageMetadataTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite; 18 | 19 | import static com.google.common.truth.Truth.assertThat; 20 | import static org.junit.Assert.assertThrows; 21 | 22 | import com.google.api.gax.rpc.ApiException; 23 | import org.junit.Test; 24 | import org.junit.runner.RunWith; 25 | import org.junit.runners.JUnit4; 26 | 27 | @RunWith(JUnit4.class) 28 | public final class MessageMetadataTest { 29 | @Test 30 | public void roundTripThroughString() { 31 | MessageMetadata metadata = MessageMetadata.of(Partition.of(10), Offset.of(20)); 32 | MessageMetadata metadata2 = MessageMetadata.decode(metadata.encode()); 33 | assertThat(metadata2).isEqualTo(metadata); 34 | } 35 | 36 | @Test 37 | public void invalidString() { 38 | assertThrows(ApiException.class, () -> MessageMetadata.decode("999")); 39 | } 40 | 41 | @Test 42 | public void invalidPartition() { 43 | assertThrows(ApiException.class, () -> MessageMetadata.decode("abc:999")); 44 | } 45 | 46 | @Test 47 | public void invalidOffset() { 48 | assertThrows(ApiException.class, () -> MessageMetadata.decode("999:abc")); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/internal/CursorClientSettingsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal; 18 | 19 | import static org.mockito.Mockito.mock; 20 | 21 | import com.google.cloud.pubsublite.CloudRegion; 22 | import com.google.cloud.pubsublite.v1.CursorServiceClient; 23 | import org.junit.Test; 24 | import org.junit.runner.RunWith; 25 | import org.junit.runners.JUnit4; 26 | 27 | @RunWith(JUnit4.class) 28 | public class CursorClientSettingsTest { 29 | @Test 30 | public void testSettings() { 31 | CursorClient unusedClient = 32 | CursorClientSettings.newBuilder() 33 | .setRegion(CloudRegion.of("us-central1")) 34 | .setServiceClient(mock(CursorServiceClient.class)) 35 | .build() 36 | .instantiate(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/internal/TopicStatsClientSettingsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal; 18 | 19 | import static org.mockito.Mockito.mock; 20 | 21 | import com.google.cloud.pubsublite.CloudRegion; 22 | import com.google.cloud.pubsublite.v1.TopicStatsServiceClient; 23 | import org.junit.Test; 24 | import org.junit.runner.RunWith; 25 | import org.junit.runners.JUnit4; 26 | 27 | @RunWith(JUnit4.class) 28 | public class TopicStatsClientSettingsTest { 29 | @Test 30 | public void testSettings() throws CheckedApiException { 31 | TopicStatsClient unusedClient = 32 | TopicStatsClientSettings.newBuilder() 33 | .setRegion(CloudRegion.of("us-central1")) 34 | .setServiceClient(mock(TopicStatsServiceClient.class)) 35 | .build() 36 | .instantiate(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/internal/wire/AssignerSettingsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import static org.mockito.Mockito.mock; 20 | 21 | import com.google.cloud.pubsublite.CloudRegion; 22 | import com.google.cloud.pubsublite.CloudZone; 23 | import com.google.cloud.pubsublite.ProjectNumber; 24 | import com.google.cloud.pubsublite.SubscriptionName; 25 | import com.google.cloud.pubsublite.SubscriptionPath; 26 | import com.google.cloud.pubsublite.v1.PartitionAssignmentServiceClient; 27 | import org.junit.Test; 28 | import org.junit.runner.RunWith; 29 | import org.junit.runners.JUnit4; 30 | 31 | @RunWith(JUnit4.class) 32 | public class AssignerSettingsTest { 33 | @Test 34 | public void testBuilder() { 35 | AssignerSettings unusedSettings = 36 | AssignerSettings.newBuilder() 37 | .setSubscriptionPath( 38 | SubscriptionPath.newBuilder() 39 | .setLocation(CloudZone.of(CloudRegion.of("us-central1"), 'a')) 40 | .setProject(ProjectNumber.of(3)) 41 | .setName(SubscriptionName.of("abc")) 42 | .build()) 43 | .setReceiver(mock(PartitionAssignmentReceiver.class)) 44 | .setServiceClient(mock(PartitionAssignmentServiceClient.class)) 45 | .build(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/internal/wire/VersionsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.internal.wire; 18 | 19 | import static com.google.common.truth.Truth.assertThat; 20 | 21 | import org.junit.Test; 22 | import org.junit.runner.RunWith; 23 | import org.junit.runners.JUnit4; 24 | 25 | @RunWith(JUnit4.class) 26 | public class VersionsTest { 27 | @Test 28 | public void badSplits() { 29 | Versions versions = new Versions("1.1"); 30 | assertThat(versions.getMajorVersion()).isEqualTo(0); 31 | assertThat(versions.getMinorVersion()).isEqualTo(0); 32 | } 33 | 34 | @Test 35 | public void garbageMajorVersion() { 36 | Versions versions = new Versions("abc.1.1"); 37 | assertThat(versions.getMajorVersion()).isEqualTo(0); 38 | assertThat(versions.getMinorVersion()).isEqualTo(1); 39 | } 40 | 41 | @Test 42 | public void garbageMinorVersion() { 43 | Versions versions = new Versions("1.abc.1"); 44 | assertThat(versions.getMajorVersion()).isEqualTo(1); 45 | assertThat(versions.getMinorVersion()).isEqualTo(0); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/v1/MockAdminService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1; 18 | 19 | import com.google.api.core.BetaApi; 20 | import com.google.api.gax.grpc.testing.MockGrpcService; 21 | import com.google.protobuf.AbstractMessage; 22 | import io.grpc.ServerServiceDefinition; 23 | import java.util.List; 24 | import javax.annotation.Generated; 25 | 26 | @BetaApi 27 | @Generated("by gapic-generator-java") 28 | public class MockAdminService implements MockGrpcService { 29 | private final MockAdminServiceImpl serviceImpl; 30 | 31 | public MockAdminService() { 32 | serviceImpl = new MockAdminServiceImpl(); 33 | } 34 | 35 | @Override 36 | public List getRequests() { 37 | return serviceImpl.getRequests(); 38 | } 39 | 40 | @Override 41 | public void addResponse(AbstractMessage response) { 42 | serviceImpl.addResponse(response); 43 | } 44 | 45 | @Override 46 | public void addException(Exception exception) { 47 | serviceImpl.addException(exception); 48 | } 49 | 50 | @Override 51 | public ServerServiceDefinition getServiceDefinition() { 52 | return serviceImpl.bindService(); 53 | } 54 | 55 | @Override 56 | public void reset() { 57 | serviceImpl.reset(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/v1/MockCursorService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1; 18 | 19 | import com.google.api.core.BetaApi; 20 | import com.google.api.gax.grpc.testing.MockGrpcService; 21 | import com.google.protobuf.AbstractMessage; 22 | import io.grpc.ServerServiceDefinition; 23 | import java.util.List; 24 | import javax.annotation.Generated; 25 | 26 | @BetaApi 27 | @Generated("by gapic-generator-java") 28 | public class MockCursorService implements MockGrpcService { 29 | private final MockCursorServiceImpl serviceImpl; 30 | 31 | public MockCursorService() { 32 | serviceImpl = new MockCursorServiceImpl(); 33 | } 34 | 35 | @Override 36 | public List getRequests() { 37 | return serviceImpl.getRequests(); 38 | } 39 | 40 | @Override 41 | public void addResponse(AbstractMessage response) { 42 | serviceImpl.addResponse(response); 43 | } 44 | 45 | @Override 46 | public void addException(Exception exception) { 47 | serviceImpl.addException(exception); 48 | } 49 | 50 | @Override 51 | public ServerServiceDefinition getServiceDefinition() { 52 | return serviceImpl.bindService(); 53 | } 54 | 55 | @Override 56 | public void reset() { 57 | serviceImpl.reset(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/v1/MockPartitionAssignmentService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1; 18 | 19 | import com.google.api.core.BetaApi; 20 | import com.google.api.gax.grpc.testing.MockGrpcService; 21 | import com.google.protobuf.AbstractMessage; 22 | import io.grpc.ServerServiceDefinition; 23 | import java.util.List; 24 | import javax.annotation.Generated; 25 | 26 | @BetaApi 27 | @Generated("by gapic-generator-java") 28 | public class MockPartitionAssignmentService implements MockGrpcService { 29 | private final MockPartitionAssignmentServiceImpl serviceImpl; 30 | 31 | public MockPartitionAssignmentService() { 32 | serviceImpl = new MockPartitionAssignmentServiceImpl(); 33 | } 34 | 35 | @Override 36 | public List getRequests() { 37 | return serviceImpl.getRequests(); 38 | } 39 | 40 | @Override 41 | public void addResponse(AbstractMessage response) { 42 | serviceImpl.addResponse(response); 43 | } 44 | 45 | @Override 46 | public void addException(Exception exception) { 47 | serviceImpl.addException(exception); 48 | } 49 | 50 | @Override 51 | public ServerServiceDefinition getServiceDefinition() { 52 | return serviceImpl.bindService(); 53 | } 54 | 55 | @Override 56 | public void reset() { 57 | serviceImpl.reset(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/v1/MockPublisherService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1; 18 | 19 | import com.google.api.core.BetaApi; 20 | import com.google.api.gax.grpc.testing.MockGrpcService; 21 | import com.google.protobuf.AbstractMessage; 22 | import io.grpc.ServerServiceDefinition; 23 | import java.util.List; 24 | import javax.annotation.Generated; 25 | 26 | @BetaApi 27 | @Generated("by gapic-generator-java") 28 | public class MockPublisherService implements MockGrpcService { 29 | private final MockPublisherServiceImpl serviceImpl; 30 | 31 | public MockPublisherService() { 32 | serviceImpl = new MockPublisherServiceImpl(); 33 | } 34 | 35 | @Override 36 | public List getRequests() { 37 | return serviceImpl.getRequests(); 38 | } 39 | 40 | @Override 41 | public void addResponse(AbstractMessage response) { 42 | serviceImpl.addResponse(response); 43 | } 44 | 45 | @Override 46 | public void addException(Exception exception) { 47 | serviceImpl.addException(exception); 48 | } 49 | 50 | @Override 51 | public ServerServiceDefinition getServiceDefinition() { 52 | return serviceImpl.bindService(); 53 | } 54 | 55 | @Override 56 | public void reset() { 57 | serviceImpl.reset(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/v1/MockSubscriberService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1; 18 | 19 | import com.google.api.core.BetaApi; 20 | import com.google.api.gax.grpc.testing.MockGrpcService; 21 | import com.google.protobuf.AbstractMessage; 22 | import io.grpc.ServerServiceDefinition; 23 | import java.util.List; 24 | import javax.annotation.Generated; 25 | 26 | @BetaApi 27 | @Generated("by gapic-generator-java") 28 | public class MockSubscriberService implements MockGrpcService { 29 | private final MockSubscriberServiceImpl serviceImpl; 30 | 31 | public MockSubscriberService() { 32 | serviceImpl = new MockSubscriberServiceImpl(); 33 | } 34 | 35 | @Override 36 | public List getRequests() { 37 | return serviceImpl.getRequests(); 38 | } 39 | 40 | @Override 41 | public void addResponse(AbstractMessage response) { 42 | serviceImpl.addResponse(response); 43 | } 44 | 45 | @Override 46 | public void addException(Exception exception) { 47 | serviceImpl.addException(exception); 48 | } 49 | 50 | @Override 51 | public ServerServiceDefinition getServiceDefinition() { 52 | return serviceImpl.bindService(); 53 | } 54 | 55 | @Override 56 | public void reset() { 57 | serviceImpl.reset(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/test/java/com/google/cloud/pubsublite/v1/MockTopicStatsService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1; 18 | 19 | import com.google.api.core.BetaApi; 20 | import com.google.api.gax.grpc.testing.MockGrpcService; 21 | import com.google.protobuf.AbstractMessage; 22 | import io.grpc.ServerServiceDefinition; 23 | import java.util.List; 24 | import javax.annotation.Generated; 25 | 26 | @BetaApi 27 | @Generated("by gapic-generator-java") 28 | public class MockTopicStatsService implements MockGrpcService { 29 | private final MockTopicStatsServiceImpl serviceImpl; 30 | 31 | public MockTopicStatsService() { 32 | serviceImpl = new MockTopicStatsServiceImpl(); 33 | } 34 | 35 | @Override 36 | public List getRequests() { 37 | return serviceImpl.getRequests(); 38 | } 39 | 40 | @Override 41 | public void addResponse(AbstractMessage response) { 42 | serviceImpl.addResponse(response); 43 | } 44 | 45 | @Override 46 | public void addException(Exception exception) { 47 | serviceImpl.addException(exception); 48 | } 49 | 50 | @Override 51 | public ServerServiceDefinition getServiceDefinition() { 52 | return serviceImpl.bindService(); 53 | } 54 | 55 | @Override 56 | public void reset() { 57 | serviceImpl.reset(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /google-cloud-pubsublite/src/test/resources/routing_tests.json: -------------------------------------------------------------------------------- 1 | // File defining a map from routing keys to the expected partition in a 29 2 | // partition topic for test purposes. This file should be copied into all client 3 | // library test suites. 4 | { 5 | "oaisdhfoiahsd": 18, 6 | "P(#*YNPOIUDF": 9, 7 | "LCIUNDFPOASIUN":8, 8 | ";odsfiupoius": 9, 9 | "OPISUDfpoiu": 2, 10 | "dokjwO:IDf": 21, 11 | "%^&*": 19, 12 | "XXXXXXXXX": 15, 13 | "dpcollins": 28, 14 | "#()&$IJHLOIURF": 2, 15 | "dfasiduyf": 6, 16 | "983u2poer": 3, 17 | "8888888": 6, 18 | "OPUIPOUYPOIOPUIOIPUOUIPJOP": 2, 19 | "x": 16 20 | } -------------------------------------------------------------------------------- /java.header: -------------------------------------------------------------------------------- 1 | ^/\*$ 2 | ^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)$ 3 | ^ \*$ 4 | ^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\);$ 5 | ^ \* you may not use this file except in compliance with the License\.$ 6 | ^ \* You may obtain a copy of the License at$ 7 | ^ \*$ 8 | ^ \*[ ]+https?://www.apache.org/licenses/LICENSE-2\.0$ 9 | ^ \*$ 10 | ^ \* Unless required by applicable law or agreed to in writing, software$ 11 | ^ \* distributed under the License is distributed on an "AS IS" BASIS,$ 12 | ^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$ 13 | ^ \* See the License for the specific language governing permissions and$ 14 | ^ \* limitations under the License\.$ 15 | ^ \*/$ 16 | -------------------------------------------------------------------------------- /license-checks.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /owlbot.py: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import synthtool as s 16 | from synthtool.languages import java 17 | 18 | 19 | for library in s.get_staging_dirs(): 20 | # put any special-case replacements here 21 | s.move(library) 22 | 23 | s.remove_staging_dirs() 24 | java.common_templates( 25 | excludes=[ 26 | ".kokoro/*/samples.cfg", 27 | "samples/install-without-bom/*", 28 | ".github/workflows/samples.yaml", 29 | '.kokoro/requirements.in', 30 | '.kokoro/requirements.txt', 31 | ".github/CODEOWNERS", 32 | ".kokoro/presubmit/graalvm-native.cfg", 33 | ".kokoro/presubmit/graalvm-native-17.cfg" 34 | ] 35 | ) 36 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/CommitCursorResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/cursor.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface CommitCursorResponseOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.CommitCursorResponse) 25 | com.google.protobuf.MessageOrBuilder {} 26 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/CursorOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/common.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface CursorOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.Cursor) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *

31 |    * The offset of a message within a topic partition. Must be greater than or
32 |    * equal 0.
33 |    * 
34 | * 35 | * int64 offset = 1; 36 | * 37 | * @return The offset. 38 | */ 39 | long getOffset(); 40 | } 41 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/DeleteSubscriptionRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/admin.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface DeleteSubscriptionRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.DeleteSubscriptionRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The name of the subscription to delete.
32 |    * 
33 | * 34 | * 35 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 36 | * 37 | * 38 | * @return The name. 39 | */ 40 | java.lang.String getName(); 41 | 42 | /** 43 | * 44 | * 45 | *
46 |    * Required. The name of the subscription to delete.
47 |    * 
48 | * 49 | * 50 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 51 | * 52 | * 53 | * @return The bytes for name. 54 | */ 55 | com.google.protobuf.ByteString getNameBytes(); 56 | } 57 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/DeleteTopicRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/admin.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface DeleteTopicRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.DeleteTopicRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The name of the topic to delete.
32 |    * 
33 | * 34 | * 35 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 36 | * 37 | * 38 | * @return The name. 39 | */ 40 | java.lang.String getName(); 41 | 42 | /** 43 | * 44 | * 45 | *
46 |    * Required. The name of the topic to delete.
47 |    * 
48 | * 49 | * 50 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 51 | * 52 | * 53 | * @return The bytes for name. 54 | */ 55 | com.google.protobuf.ByteString getNameBytes(); 56 | } 57 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/FlowControlRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/subscriber.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface FlowControlRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.FlowControlRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * The number of message tokens to grant. Must be greater than or equal to 0.
32 |    * 
33 | * 34 | * int64 allowed_messages = 1; 35 | * 36 | * @return The allowedMessages. 37 | */ 38 | long getAllowedMessages(); 39 | 40 | /** 41 | * 42 | * 43 | *
44 |    * The number of byte tokens to grant. Must be greater than or equal to 0.
45 |    * 
46 | * 47 | * int64 allowed_bytes = 2; 48 | * 49 | * @return The allowedBytes. 50 | */ 51 | long getAllowedBytes(); 52 | } 53 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/GetSubscriptionRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/admin.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface GetSubscriptionRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.GetSubscriptionRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The name of the subscription whose configuration to return.
32 |    * 
33 | * 34 | * 35 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 36 | * 37 | * 38 | * @return The name. 39 | */ 40 | java.lang.String getName(); 41 | 42 | /** 43 | * 44 | * 45 | *
46 |    * Required. The name of the subscription whose configuration to return.
47 |    * 
48 | * 49 | * 50 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 51 | * 52 | * 53 | * @return The bytes for name. 54 | */ 55 | com.google.protobuf.ByteString getNameBytes(); 56 | } 57 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/GetTopicPartitionsRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/admin.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface GetTopicPartitionsRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.GetTopicPartitionsRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The topic whose partition information to return.
32 |    * 
33 | * 34 | * 35 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 36 | * 37 | * 38 | * @return The name. 39 | */ 40 | java.lang.String getName(); 41 | 42 | /** 43 | * 44 | * 45 | *
46 |    * Required. The topic whose partition information to return.
47 |    * 
48 | * 49 | * 50 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 51 | * 52 | * 53 | * @return The bytes for name. 54 | */ 55 | com.google.protobuf.ByteString getNameBytes(); 56 | } 57 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/GetTopicRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/admin.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface GetTopicRequestOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.GetTopicRequest) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * Required. The name of the topic whose configuration to return.
32 |    * 
33 | * 34 | * 35 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 36 | * 37 | * 38 | * @return The name. 39 | */ 40 | java.lang.String getName(); 41 | 42 | /** 43 | * 44 | * 45 | *
46 |    * Required. The name of the topic whose configuration to return.
47 |    * 
48 | * 49 | * 50 | * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 51 | * 52 | * 53 | * @return The bytes for name. 54 | */ 55 | com.google.protobuf.ByteString getNameBytes(); 56 | } 57 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/InitialCommitCursorResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/cursor.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface InitialCommitCursorResponseOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.InitialCommitCursorResponse) 25 | com.google.protobuf.MessageOrBuilder {} 26 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/InitialPublishResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/publisher.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface InitialPublishResponseOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.InitialPublishResponse) 25 | com.google.protobuf.MessageOrBuilder {} 26 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/PartitionAssignmentAckOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/subscriber.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface PartitionAssignmentAckOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.PartitionAssignmentAck) 25 | com.google.protobuf.MessageOrBuilder {} 26 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/SeekSubscriptionResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/admin.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface SeekSubscriptionResponseOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.SeekSubscriptionResponse) 25 | com.google.protobuf.MessageOrBuilder {} 26 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/SequencedCommitCursorResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/cursor.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface SequencedCommitCursorResponseOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.SequencedCommitCursorResponse) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * The number of outstanding SequencedCommitCursorRequests acknowledged by
32 |    * this response. Note that SequencedCommitCursorRequests are acknowledged in
33 |    * the order that they are received.
34 |    * 
35 | * 36 | * int64 acknowledged_commits = 1; 37 | * 38 | * @return The acknowledgedCommits. 39 | */ 40 | long getAcknowledgedCommits(); 41 | } 42 | -------------------------------------------------------------------------------- /proto-google-cloud-pubsublite-v1/src/main/java/com/google/cloud/pubsublite/proto/TopicPartitionsOrBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | // Generated by the protocol buffer compiler. DO NOT EDIT! 17 | // source: google/cloud/pubsublite/v1/admin.proto 18 | 19 | // Protobuf Java Version: 3.25.8 20 | package com.google.cloud.pubsublite.proto; 21 | 22 | public interface TopicPartitionsOrBuilder 23 | extends 24 | // @@protoc_insertion_point(interface_extends:google.cloud.pubsublite.v1.TopicPartitions) 25 | com.google.protobuf.MessageOrBuilder { 26 | 27 | /** 28 | * 29 | * 30 | *
31 |    * The number of partitions in the topic.
32 |    * 
33 | * 34 | * int64 partition_count = 1; 35 | * 36 | * @return The partitionCount. 37 | */ 38 | long getPartitionCount(); 39 | } 40 | -------------------------------------------------------------------------------- /samples/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Pub/Sub Lite Samples 2 | 3 | ## Running samples and tests using Cloud Shell 4 | 5 | [Google Cloud Shell](https://cloud.google.com/shell) has application default credentials from its compute instance which will allow you to run an integration test without having to obtain `GOOGLE_APPLICATION_CREDENTIALS`. 6 | 7 | However, tests require an additional environment variable `GOOGLE_CLOUD_PROJECT_NUMBER` to run. For instance, 8 | 9 | In [`QuickStartIT.java`](snippets/src/test/java/pubsublite/QuickStartIT.java): 10 | 11 | ```java 12 | private static final String GOOGLE_CLOUD_PROJECT_NUMBER = 13 | System.getenv("GOOGLE_CLOUD_PROJECT_NUMBER"); 14 | ``` 15 | Here, the program needs you to provide your [Google Cloud Project Number](https://cloud.google.com/resource-manager/docs/creating-managing-projects) in an environment variable. 16 | 17 | To run a sample's integration test in Cloud Shell: 18 | 19 | 1. `cd samples/` - all samples are located in `java-pubsublite/samples/snippets` directory. 20 | 21 | 1. `mvn clean -Dtest=QuickStartIT test` - this runs the integration test for `UpdateTopicExample.java`. 22 | 23 | To run a sample, update the developer's TODO section in the snippet, then: 24 | 25 | 1. `cd samples/snippets/` - all samples are located in `java-pubsublite/samples/snippets` directory. 26 | 27 | 1. `mvn compile exec:java -Dexec.mainClass=pubsublite.ListTopicsExample` - this should list the topics in your project. 28 | -------------------------------------------------------------------------------- /samples/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /samples/snippets/generated/com/google/cloud/pubsublite/v1/adminservice/create/SyncCreateSetEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1.samples; 18 | 19 | // [START pubsublite_v1_generated_AdminService_Create_SetEndpoint_sync] 20 | import com.google.cloud.pubsublite.v1.AdminServiceClient; 21 | import com.google.cloud.pubsublite.v1.AdminServiceSettings; 22 | import com.google.cloud.pubsublite.v1.myEndpoint; 23 | 24 | public class SyncCreateSetEndpoint { 25 | 26 | public static void main(String[] args) throws Exception { 27 | syncCreateSetEndpoint(); 28 | } 29 | 30 | public static void syncCreateSetEndpoint() throws Exception { 31 | // This snippet has been automatically generated and should be regarded as a code template only. 32 | // It will require modifications to work: 33 | // - It may require correct/in-range values for request initialization. 34 | // - It may require specifying regional endpoints when creating the service client as shown in 35 | // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 36 | AdminServiceSettings adminServiceSettings = 37 | AdminServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); 38 | AdminServiceClient adminServiceClient = AdminServiceClient.create(adminServiceSettings); 39 | } 40 | } 41 | // [END pubsublite_v1_generated_AdminService_Create_SetEndpoint_sync] 42 | -------------------------------------------------------------------------------- /samples/snippets/generated/com/google/cloud/pubsublite/v1/adminservice/deletetopic/SyncDeleteTopicString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1.samples; 18 | 19 | // [START pubsublite_v1_generated_AdminService_DeleteTopic_String_sync] 20 | import com.google.cloud.pubsublite.proto.TopicName; 21 | import com.google.cloud.pubsublite.v1.AdminServiceClient; 22 | import com.google.protobuf.Empty; 23 | 24 | public class SyncDeleteTopicString { 25 | 26 | public static void main(String[] args) throws Exception { 27 | syncDeleteTopicString(); 28 | } 29 | 30 | public static void syncDeleteTopicString() throws Exception { 31 | // This snippet has been automatically generated and should be regarded as a code template only. 32 | // It will require modifications to work: 33 | // - It may require correct/in-range values for request initialization. 34 | // - It may require specifying regional endpoints when creating the service client as shown in 35 | // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 36 | try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { 37 | String name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString(); 38 | adminServiceClient.deleteTopic(name); 39 | } 40 | } 41 | } 42 | // [END pubsublite_v1_generated_AdminService_DeleteTopic_String_sync] 43 | -------------------------------------------------------------------------------- /samples/snippets/generated/com/google/cloud/pubsublite/v1/adminservice/deletetopic/SyncDeleteTopicTopicname.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1.samples; 18 | 19 | // [START pubsublite_v1_generated_AdminService_DeleteTopic_Topicname_sync] 20 | import com.google.cloud.pubsublite.proto.TopicName; 21 | import com.google.cloud.pubsublite.v1.AdminServiceClient; 22 | import com.google.protobuf.Empty; 23 | 24 | public class SyncDeleteTopicTopicname { 25 | 26 | public static void main(String[] args) throws Exception { 27 | syncDeleteTopicTopicname(); 28 | } 29 | 30 | public static void syncDeleteTopicTopicname() throws Exception { 31 | // This snippet has been automatically generated and should be regarded as a code template only. 32 | // It will require modifications to work: 33 | // - It may require correct/in-range values for request initialization. 34 | // - It may require specifying regional endpoints when creating the service client as shown in 35 | // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 36 | try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { 37 | TopicName name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]"); 38 | adminServiceClient.deleteTopic(name); 39 | } 40 | } 41 | } 42 | // [END pubsublite_v1_generated_AdminService_DeleteTopic_Topicname_sync] 43 | -------------------------------------------------------------------------------- /samples/snippets/generated/com/google/cloud/pubsublite/v1/adminservice/gettopic/SyncGetTopicString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1.samples; 18 | 19 | // [START pubsublite_v1_generated_AdminService_GetTopic_String_sync] 20 | import com.google.cloud.pubsublite.proto.Topic; 21 | import com.google.cloud.pubsublite.proto.TopicName; 22 | import com.google.cloud.pubsublite.v1.AdminServiceClient; 23 | 24 | public class SyncGetTopicString { 25 | 26 | public static void main(String[] args) throws Exception { 27 | syncGetTopicString(); 28 | } 29 | 30 | public static void syncGetTopicString() throws Exception { 31 | // This snippet has been automatically generated and should be regarded as a code template only. 32 | // It will require modifications to work: 33 | // - It may require correct/in-range values for request initialization. 34 | // - It may require specifying regional endpoints when creating the service client as shown in 35 | // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 36 | try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { 37 | String name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]").toString(); 38 | Topic response = adminServiceClient.getTopic(name); 39 | } 40 | } 41 | } 42 | // [END pubsublite_v1_generated_AdminService_GetTopic_String_sync] 43 | -------------------------------------------------------------------------------- /samples/snippets/generated/com/google/cloud/pubsublite/v1/adminservice/gettopic/SyncGetTopicTopicname.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.cloud.pubsublite.v1.samples; 18 | 19 | // [START pubsublite_v1_generated_AdminService_GetTopic_Topicname_sync] 20 | import com.google.cloud.pubsublite.proto.Topic; 21 | import com.google.cloud.pubsublite.proto.TopicName; 22 | import com.google.cloud.pubsublite.v1.AdminServiceClient; 23 | 24 | public class SyncGetTopicTopicname { 25 | 26 | public static void main(String[] args) throws Exception { 27 | syncGetTopicTopicname(); 28 | } 29 | 30 | public static void syncGetTopicTopicname() throws Exception { 31 | // This snippet has been automatically generated and should be regarded as a code template only. 32 | // It will require modifications to work: 33 | // - It may require correct/in-range values for request initialization. 34 | // - It may require specifying regional endpoints when creating the service client as shown in 35 | // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 36 | try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) { 37 | TopicName name = TopicName.of("[PROJECT]", "[LOCATION]", "[TOPIC]"); 38 | Topic response = adminServiceClient.getTopic(name); 39 | } 40 | } 41 | } 42 | // [END pubsublite_v1_generated_AdminService_GetTopic_Topicname_sync] 43 | -------------------------------------------------------------------------------- /versions.txt: -------------------------------------------------------------------------------- 1 | # Format: 2 | # module:released-version:current-version 3 | 4 | google-cloud-pubsublite:1.15.9:1.15.9 5 | pubsublite-beam-io:0.34.9:0.34.9 6 | proto-google-cloud-pubsublite-v1:1.15.9:1.15.9 7 | grpc-google-cloud-pubsublite-v1:1.15.9:1.15.9 8 | --------------------------------------------------------------------------------