publisher.proto 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. syntax = "proto3";
  15. package google.cloud.pubsublite.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/cloud/pubsublite/v1/common.proto";
  19. option cc_enable_arenas = true;
  20. option csharp_namespace = "Google.Cloud.PubSubLite.V1";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/pubsublite/v1;pubsublite";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "PublisherProto";
  24. option java_package = "com.google.cloud.pubsublite.proto";
  25. option php_namespace = "Google\\Cloud\\PubSubLite\\V1";
  26. option ruby_package = "Google::Cloud::PubSubLite::V1";
  27. // The service that a publisher client application uses to publish messages to
  28. // topics. Published messages are retained by the service for the duration of
  29. // the retention period configured for the respective topic, and are delivered
  30. // to subscriber clients upon request (via the `SubscriberService`).
  31. service PublisherService {
  32. option (google.api.default_host) = "pubsublite.googleapis.com";
  33. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  34. // Establishes a stream with the server for publishing messages. Once the
  35. // stream is initialized, the client publishes messages by sending publish
  36. // requests on the stream. The server responds with a PublishResponse for each
  37. // PublishRequest sent by the client, in the same order that the requests
  38. // were sent. Note that multiple PublishRequests can be in flight
  39. // simultaneously, but they will be processed by the server in the order that
  40. // they are sent by the client on a given stream.
  41. rpc Publish(stream PublishRequest) returns (stream PublishResponse) {
  42. }
  43. }
  44. // The first request that must be sent on a newly-opened stream.
  45. message InitialPublishRequest {
  46. // The topic to which messages will be written.
  47. string topic = 1;
  48. // The partition within the topic to which messages will be written.
  49. // Partitions are zero indexed, so `partition` must be in the range [0,
  50. // topic.num_partitions).
  51. int64 partition = 2;
  52. }
  53. // Response to an InitialPublishRequest.
  54. message InitialPublishResponse {
  55. }
  56. // Request to publish messages to the topic.
  57. message MessagePublishRequest {
  58. // The messages to publish.
  59. repeated PubSubMessage messages = 1;
  60. }
  61. // Response to a MessagePublishRequest.
  62. message MessagePublishResponse {
  63. // The cursor of the first published message in the batch. The cursors for any
  64. // remaining messages in the batch are guaranteed to be sequential.
  65. Cursor start_cursor = 1;
  66. }
  67. // Request sent from the client to the server on a stream.
  68. message PublishRequest {
  69. // The type of request this is.
  70. oneof request_type {
  71. // Initial request on the stream.
  72. InitialPublishRequest initial_request = 1;
  73. // Request to publish messages.
  74. MessagePublishRequest message_publish_request = 2;
  75. }
  76. }
  77. // Response to a PublishRequest.
  78. message PublishResponse {
  79. // The type of response this is.
  80. oneof response_type {
  81. // Initial response on the stream.
  82. InitialPublishResponse initial_response = 1;
  83. // Response to publishing messages.
  84. MessagePublishResponse message_response = 2;
  85. }
  86. }