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