google_cloud_pubsub/subscriber/shutdown_behavior.rs
1// Copyright 2026 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/// The behavior on shutdown for a stream.
16#[derive(Clone, Copy, Debug, PartialEq)]
17#[non_exhaustive]
18pub enum ShutdownBehavior {
19 /// The subscriber stops reading from the underlying gRPC stream.
20 ///
21 /// The subscriber continues to accept acknowledgements for messages it has
22 /// delivered to the application. The subscriber continues to extend leases
23 /// for these messages while it waits on the application to ack/nack them.
24 ///
25 /// The shutdown is complete when all message handles delivered to the
26 /// application have been consumed, and all pending ack/nack RPCs have
27 /// completed.
28 WaitForProcessing,
29
30 /// The subscriber stops reading from the underlying gRPC stream.
31 ///
32 /// The subscriber stops accepting acknowledgements from the application.
33 /// The subscriber sends all pending acknowledgements to the server. The
34 /// subscriber nacks all other messages under lease management.
35 ///
36 /// The shutdown is complete when all pending ack/nack RPCs have completed.
37 NackImmediately,
38}