|
| 1 | +// Copyright (c) 2015, Google Inc. |
| 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 | +syntax = "proto3"; |
| 16 | + |
| 17 | +package google.pubsub.v1beta2; |
| 18 | + |
| 19 | +import "google/protobuf/empty.proto"; |
| 20 | + |
| 21 | +option go_package = "google.golang.org/genproto/googleapis/pubsub/v1beta2;pubsub"; |
| 22 | +option java_multiple_files = true; |
| 23 | +option java_outer_classname = "PubsubProto"; |
| 24 | +option java_package = "com.google.pubsub.v1beta2"; |
| 25 | + |
| 26 | + |
| 27 | +// The service that an application uses to manipulate subscriptions and to |
| 28 | +// consume messages from a subscription via the Pull method. |
| 29 | +service Subscriber { |
| 30 | + // Creates a subscription to a given topic for a given subscriber. |
| 31 | + // If the subscription already exists, returns ALREADY_EXISTS. |
| 32 | + // If the corresponding topic doesn't exist, returns NOT_FOUND. |
| 33 | + // |
| 34 | + // If the name is not provided in the request, the server will assign a random |
| 35 | + // name for this subscription on the same project as the topic. |
| 36 | + rpc CreateSubscription(Subscription) returns (Subscription); |
| 37 | + |
| 38 | + // Gets the configuration details of a subscription. |
| 39 | + rpc GetSubscription(GetSubscriptionRequest) returns (Subscription); |
| 40 | + |
| 41 | + // Lists matching subscriptions. |
| 42 | + rpc ListSubscriptions(ListSubscriptionsRequest) returns (ListSubscriptionsResponse); |
| 43 | + |
| 44 | + // Deletes an existing subscription. All pending messages in the subscription |
| 45 | + // are immediately dropped. Calls to Pull after deletion will return |
| 46 | + // NOT_FOUND. After a subscription is deleted, a new one may be created with |
| 47 | + // the same name, but the new one has no association with the old |
| 48 | + // subscription, or its topic unless the same topic is specified. |
| 49 | + rpc DeleteSubscription(DeleteSubscriptionRequest) returns (google.protobuf.Empty); |
| 50 | + |
| 51 | + // Modifies the ack deadline for a specific message. This method is useful to |
| 52 | + // indicate that more time is needed to process a message by the subscriber, |
| 53 | + // or to make the message available for redelivery if the processing was |
| 54 | + // interrupted. |
| 55 | + rpc ModifyAckDeadline(ModifyAckDeadlineRequest) returns (google.protobuf.Empty); |
| 56 | + |
| 57 | + // Acknowledges the messages associated with the ack tokens in the |
| 58 | + // AcknowledgeRequest. The Pub/Sub system can remove the relevant messages |
| 59 | + // from the subscription. |
| 60 | + // |
| 61 | + // Acknowledging a message whose ack deadline has expired may succeed, |
| 62 | + // but such a message may be redelivered later. Acknowledging a message more |
| 63 | + // than once will not result in an error. |
| 64 | + rpc Acknowledge(AcknowledgeRequest) returns (google.protobuf.Empty); |
| 65 | + |
| 66 | + // Pulls messages from the server. Returns an empty list if there are no |
| 67 | + // messages available in the backlog. The server may return UNAVAILABLE if |
| 68 | + // there are too many concurrent pull requests pending for the given |
| 69 | + // subscription. |
| 70 | + rpc Pull(PullRequest) returns (PullResponse); |
| 71 | + |
| 72 | + // Modifies the PushConfig for a specified subscription. |
| 73 | + // |
| 74 | + // This may be used to change a push subscription to a pull one (signified |
| 75 | + // by an empty PushConfig) or vice versa, or change the endpoint URL and other |
| 76 | + // attributes of a push subscription. Messages will accumulate for |
| 77 | + // delivery continuously through the call regardless of changes to the |
| 78 | + // PushConfig. |
| 79 | + rpc ModifyPushConfig(ModifyPushConfigRequest) returns (google.protobuf.Empty); |
| 80 | +} |
| 81 | + |
| 82 | +// The service that an application uses to manipulate topics, and to send |
| 83 | +// messages to a topic. |
| 84 | +service Publisher { |
| 85 | + // Creates the given topic with the given name. |
| 86 | + rpc CreateTopic(Topic) returns (Topic); |
| 87 | + |
| 88 | + // Adds one or more messages to the topic. Returns NOT_FOUND if the topic does |
| 89 | + // not exist. |
| 90 | + rpc Publish(PublishRequest) returns (PublishResponse); |
| 91 | + |
| 92 | + // Gets the configuration of a topic. |
| 93 | + rpc GetTopic(GetTopicRequest) returns (Topic); |
| 94 | + |
| 95 | + // Lists matching topics. |
| 96 | + rpc ListTopics(ListTopicsRequest) returns (ListTopicsResponse); |
| 97 | + |
| 98 | + // Lists the name of the subscriptions for this topic. |
| 99 | + rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest) returns (ListTopicSubscriptionsResponse); |
| 100 | + |
| 101 | + // Deletes the topic with the given name. Returns NOT_FOUND if the topic does |
| 102 | + // not exist. After a topic is deleted, a new topic may be created with the |
| 103 | + // same name; this is an entirely new topic with none of the old |
| 104 | + // configuration or subscriptions. Existing subscriptions to this topic are |
| 105 | + // not deleted. |
| 106 | + rpc DeleteTopic(DeleteTopicRequest) returns (google.protobuf.Empty); |
| 107 | +} |
| 108 | + |
| 109 | +// A topic resource. |
| 110 | +message Topic { |
| 111 | + // Name of the topic. |
| 112 | + string name = 1; |
| 113 | +} |
| 114 | + |
| 115 | +// A message data and its attributes. |
| 116 | +message PubsubMessage { |
| 117 | + // The message payload. For JSON requests, the value of this field must be |
| 118 | + // base64-encoded. |
| 119 | + bytes data = 1; |
| 120 | + |
| 121 | + // Optional attributes for this message. |
| 122 | + map<string, string> attributes = 2; |
| 123 | + |
| 124 | + // ID of this message assigned by the server at publication time. Guaranteed |
| 125 | + // to be unique within the topic. This value may be read by a subscriber |
| 126 | + // that receives a PubsubMessage via a Pull call or a push delivery. It must |
| 127 | + // not be populated by a publisher in a Publish call. |
| 128 | + string message_id = 3; |
| 129 | +} |
| 130 | + |
| 131 | +// Request for the GetTopic method. |
| 132 | +message GetTopicRequest { |
| 133 | + // The name of the topic to get. |
| 134 | + string topic = 1; |
| 135 | +} |
| 136 | + |
| 137 | +// Request for the Publish method. |
| 138 | +message PublishRequest { |
| 139 | + // The messages in the request will be published on this topic. |
| 140 | + string topic = 1; |
| 141 | + |
| 142 | + // The messages to publish. |
| 143 | + repeated PubsubMessage messages = 2; |
| 144 | +} |
| 145 | + |
| 146 | +// Response for the Publish method. |
| 147 | +message PublishResponse { |
| 148 | + // The server-assigned ID of each published message, in the same order as |
| 149 | + // the messages in the request. IDs are guaranteed to be unique within |
| 150 | + // the topic. |
| 151 | + repeated string message_ids = 1; |
| 152 | +} |
| 153 | + |
| 154 | +// Request for the ListTopics method. |
| 155 | +message ListTopicsRequest { |
| 156 | + // The name of the cloud project that topics belong to. |
| 157 | + string project = 1; |
| 158 | + |
| 159 | + // Maximum number of topics to return. |
| 160 | + int32 page_size = 2; |
| 161 | + |
| 162 | + // The value returned by the last ListTopicsResponse; indicates that this is |
| 163 | + // a continuation of a prior ListTopics call, and that the system should |
| 164 | + // return the next page of data. |
| 165 | + string page_token = 3; |
| 166 | +} |
| 167 | + |
| 168 | +// Response for the ListTopics method. |
| 169 | +message ListTopicsResponse { |
| 170 | + // The resulting topics. |
| 171 | + repeated Topic topics = 1; |
| 172 | + |
| 173 | + // If not empty, indicates that there may be more topics that match the |
| 174 | + // request; this value should be passed in a new ListTopicsRequest. |
| 175 | + string next_page_token = 2; |
| 176 | +} |
| 177 | + |
| 178 | +// Request for the ListTopicSubscriptions method. |
| 179 | +message ListTopicSubscriptionsRequest { |
| 180 | + // The name of the topic that subscriptions are attached to. |
| 181 | + string topic = 1; |
| 182 | + |
| 183 | + // Maximum number of subscription names to return. |
| 184 | + int32 page_size = 2; |
| 185 | + |
| 186 | + // The value returned by the last ListTopicSubscriptionsResponse; indicates |
| 187 | + // that this is a continuation of a prior ListTopicSubscriptions call, and |
| 188 | + // that the system should return the next page of data. |
| 189 | + string page_token = 3; |
| 190 | +} |
| 191 | + |
| 192 | +// Response for the ListTopicSubscriptions method. |
| 193 | +message ListTopicSubscriptionsResponse { |
| 194 | + // The names of the subscriptions that match the request. |
| 195 | + repeated string subscriptions = 1; |
| 196 | + |
| 197 | + // If not empty, indicates that there may be more subscriptions that match |
| 198 | + // the request; this value should be passed in a new |
| 199 | + // ListTopicSubscriptionsRequest to get more subscriptions. |
| 200 | + string next_page_token = 2; |
| 201 | +} |
| 202 | + |
| 203 | +// Request for the DeleteTopic method. |
| 204 | +message DeleteTopicRequest { |
| 205 | + // Name of the topic to delete. |
| 206 | + string topic = 1; |
| 207 | +} |
| 208 | + |
| 209 | +// A subscription resource. |
| 210 | +message Subscription { |
| 211 | + // Name of the subscription. |
| 212 | + string name = 1; |
| 213 | + |
| 214 | + // The name of the topic from which this subscription is receiving messages. |
| 215 | + // This will be present if and only if the subscription has not been detached |
| 216 | + // from its topic. |
| 217 | + string topic = 2; |
| 218 | + |
| 219 | + // If push delivery is used with this subscription, this field is |
| 220 | + // used to configure it. An empty pushConfig signifies that the subscriber |
| 221 | + // will pull and ack messages using API methods. |
| 222 | + PushConfig push_config = 4; |
| 223 | + |
| 224 | + // This value is the maximum time after a subscriber receives a message |
| 225 | + // before the subscriber should acknowledge the message. After message |
| 226 | + // delivery but before the ack deadline expires and before the message is |
| 227 | + // acknowledged, it is an outstanding message and will not be delivered |
| 228 | + // again during that time (on a best-effort basis). |
| 229 | + // |
| 230 | + // For pull delivery this value |
| 231 | + // is used as the initial value for the ack deadline. It may be overridden |
| 232 | + // for a specific message by calling ModifyAckDeadline. |
| 233 | + // |
| 234 | + // For push delivery, this value is also used to set the request timeout for |
| 235 | + // the call to the push endpoint. |
| 236 | + // |
| 237 | + // If the subscriber never acknowledges the message, the Pub/Sub |
| 238 | + // system will eventually redeliver the message. |
| 239 | + int32 ack_deadline_seconds = 5; |
| 240 | +} |
| 241 | + |
| 242 | +// Configuration for a push delivery endpoint. |
| 243 | +message PushConfig { |
| 244 | + // A URL locating the endpoint to which messages should be pushed. |
| 245 | + // For example, a Webhook endpoint might use "https://example.com/push". |
| 246 | + string push_endpoint = 1; |
| 247 | + |
| 248 | + // Endpoint configuration attributes. |
| 249 | + // |
| 250 | + // Every endpoint has a set of API supported attributes that can be used to |
| 251 | + // control different aspects of the message delivery. |
| 252 | + // |
| 253 | + // The currently supported attribute is `x-goog-version`, which you can |
| 254 | + // use to change the format of the push message. This attribute |
| 255 | + // indicates the version of the data expected by the endpoint. This |
| 256 | + // controls the shape of the envelope (i.e. its fields and metadata). |
| 257 | + // The endpoint version is based on the version of the Pub/Sub |
| 258 | + // API. |
| 259 | + // |
| 260 | + // If not present during the CreateSubscription call, it will default to |
| 261 | + // the version of the API used to make such call. If not present during a |
| 262 | + // ModifyPushConfig call, its value will not be changed. GetSubscription |
| 263 | + // calls will always return a valid version, even if the subscription was |
| 264 | + // created without this attribute. |
| 265 | + // |
| 266 | + // The possible values for this attribute are: |
| 267 | + // |
| 268 | + // * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. |
| 269 | + // * `v1beta2`: uses the push format defined in the v1beta2 Pub/Sub API. |
| 270 | + // |
| 271 | + map<string, string> attributes = 2; |
| 272 | +} |
| 273 | + |
| 274 | +// A message and its corresponding acknowledgment ID. |
| 275 | +message ReceivedMessage { |
| 276 | + // This ID can be used to acknowledge the received message. |
| 277 | + string ack_id = 1; |
| 278 | + |
| 279 | + // The message. |
| 280 | + PubsubMessage message = 2; |
| 281 | +} |
| 282 | + |
| 283 | +// Request for the GetSubscription method. |
| 284 | +message GetSubscriptionRequest { |
| 285 | + // The name of the subscription to get. |
| 286 | + string subscription = 1; |
| 287 | +} |
| 288 | + |
| 289 | +// Request for the ListSubscriptions method. |
| 290 | +message ListSubscriptionsRequest { |
| 291 | + // The name of the cloud project that subscriptions belong to. |
| 292 | + string project = 1; |
| 293 | + |
| 294 | + // Maximum number of subscriptions to return. |
| 295 | + int32 page_size = 2; |
| 296 | + |
| 297 | + // The value returned by the last ListSubscriptionsResponse; indicates that |
| 298 | + // this is a continuation of a prior ListSubscriptions call, and that the |
| 299 | + // system should return the next page of data. |
| 300 | + string page_token = 3; |
| 301 | +} |
| 302 | + |
| 303 | +// Response for the ListSubscriptions method. |
| 304 | +message ListSubscriptionsResponse { |
| 305 | + // The subscriptions that match the request. |
| 306 | + repeated Subscription subscriptions = 1; |
| 307 | + |
| 308 | + // If not empty, indicates that there may be more subscriptions that match |
| 309 | + // the request; this value should be passed in a new ListSubscriptionsRequest |
| 310 | + // to get more subscriptions. |
| 311 | + string next_page_token = 2; |
| 312 | +} |
| 313 | + |
| 314 | +// Request for the DeleteSubscription method. |
| 315 | +message DeleteSubscriptionRequest { |
| 316 | + // The subscription to delete. |
| 317 | + string subscription = 1; |
| 318 | +} |
| 319 | + |
| 320 | +// Request for the ModifyPushConfig method. |
| 321 | +message ModifyPushConfigRequest { |
| 322 | + // The name of the subscription. |
| 323 | + string subscription = 1; |
| 324 | + |
| 325 | + // The push configuration for future deliveries. |
| 326 | + // |
| 327 | + // An empty pushConfig indicates that the Pub/Sub system should |
| 328 | + // stop pushing messages from the given subscription and allow |
| 329 | + // messages to be pulled and acknowledged - effectively pausing |
| 330 | + // the subscription if Pull is not called. |
| 331 | + PushConfig push_config = 2; |
| 332 | +} |
| 333 | + |
| 334 | +// Request for the Pull method. |
| 335 | +message PullRequest { |
| 336 | + // The subscription from which messages should be pulled. |
| 337 | + string subscription = 1; |
| 338 | + |
| 339 | + // If this is specified as true the system will respond immediately even if |
| 340 | + // it is not able to return a message in the Pull response. Otherwise the |
| 341 | + // system is allowed to wait until at least one message is available rather |
| 342 | + // than returning no messages. The client may cancel the request if it does |
| 343 | + // not wish to wait any longer for the response. |
| 344 | + bool return_immediately = 2; |
| 345 | + |
| 346 | + // The maximum number of messages returned for this request. The Pub/Sub |
| 347 | + // system may return fewer than the number specified. |
| 348 | + int32 max_messages = 3; |
| 349 | +} |
| 350 | + |
| 351 | +// Response for the Pull method. |
| 352 | +message PullResponse { |
| 353 | + // Received Pub/Sub messages. The Pub/Sub system will return zero messages if |
| 354 | + // there are no more available in the backlog. The Pub/Sub system may return |
| 355 | + // fewer than the maxMessages requested even if there are more messages |
| 356 | + // available in the backlog. |
| 357 | + repeated ReceivedMessage received_messages = 1; |
| 358 | +} |
| 359 | + |
| 360 | +// Request for the ModifyAckDeadline method. |
| 361 | +message ModifyAckDeadlineRequest { |
| 362 | + // The name of the subscription. |
| 363 | + string subscription = 1; |
| 364 | + |
| 365 | + // The acknowledgment ID. |
| 366 | + string ack_id = 2; |
| 367 | + |
| 368 | + // The new ack deadline with respect to the time this request was sent to the |
| 369 | + // Pub/Sub system. Must be >= 0. For example, if the value is 10, the new ack |
| 370 | + // deadline will expire 10 seconds after the ModifyAckDeadline call was made. |
| 371 | + // Specifying zero may immediately make the message available for another pull |
| 372 | + // request. |
| 373 | + int32 ack_deadline_seconds = 3; |
| 374 | +} |
| 375 | + |
| 376 | +// Request for the Acknowledge method. |
| 377 | +message AcknowledgeRequest { |
| 378 | + // The subscription whose message is being acknowledged. |
| 379 | + string subscription = 1; |
| 380 | + |
| 381 | + // The acknowledgment ID for the messages being acknowledged that was returned |
| 382 | + // by the Pub/Sub system in the Pull response. Must not be empty. |
| 383 | + repeated string ack_ids = 2; |
| 384 | +} |
0 commit comments