Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Mark exactly once delivery as preview #656

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ branchProtectionRules:
- 'Samples - Lint'
- 'Samples - Python 3.7'
- 'Samples - Python 3.8'
- 'Samples - Python 3.9'
- 'Samples - Python 3.10'
42 changes: 27 additions & 15 deletions google/cloud/pubsub_v1/subscriber/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@ def ack(self) -> None:
receive any given message more than once. If you need strong
guarantees about acks and re-deliveres, enable exactly-once
delivery on your subscription and use the `ack_with_response`
method instead.
method instead. Exactly once delivery is a preview feature.
For more details, see:
https://cloud.google.com/pubsub/docs/exactly-once-delivery."

"""
time_to_ack = math.ceil(time.time() - self._received_timestamp)
self._request_queue.put(
Expand All @@ -268,13 +271,6 @@ def ack_with_response(self) -> "futures.Future":
*finished* processing them, so that in the event of a failure,
you receive the message again.

If exactly-once delivery is enabled on the subscription, the
future returned by this method tracks the state of acknowledgement
operation. If the future completes successfully, the message is
guaranteed NOT to be re-delivered. Otherwise, the future will
contain an exception with more details about the failure and the
message may be re-delivered.

If exactly-once delivery is NOT enabled on the subscription, the
future returns immediately with an AcknowledgeStatus.SUCCESS.
Since acks in Cloud Pub/Sub are best effort when exactly-once
Expand All @@ -283,6 +279,16 @@ def ack_with_response(self) -> "futures.Future":
code is idempotent, as you may receive any given message more than
once.

If exactly-once delivery is enabled on the subscription, the
future returned by this method tracks the state of acknowledgement
operation. If the future completes successfully, the message is
guaranteed NOT to be re-delivered. Otherwise, the future will
contain an exception with more details about the failure and the
message may be re-delivered.

Exactly once delivery is a preview feature. For more details,
see https://cloud.google.com/pubsub/docs/exactly-once-delivery."

Returns:
A :class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
instance that conforms to Python Standard library's
Expand Down Expand Up @@ -363,6 +369,12 @@ def modify_ack_deadline_with_response(self, seconds: int) -> "futures.Future":
if you are implementing your own custom subclass of
:class:`~.pubsub_v1.subcriber._consumer.Consumer`.

If exactly-once delivery is NOT enabled on the subscription, the
future returns immediately with an AcknowledgeStatus.SUCCESS.
Since modify-ack-deadline operations in Cloud Pub/Sub are best effort
when exactly-once delivery is disabled, the message may be re-delivered
within the set deadline.

If exactly-once delivery is enabled on the subscription, the
future returned by this method tracks the state of the
modify-ack-deadline operation. If the future completes successfully,
Expand All @@ -371,11 +383,8 @@ def modify_ack_deadline_with_response(self, seconds: int) -> "futures.Future":
the failure and the message will be redelivered according to its
currently-set ack deadline.

If exactly-once delivery is NOT enabled on the subscription, the
future returns immediately with an AcknowledgeStatus.SUCCESS.
Since modify-ack-deadline operations in Cloud Pub/Sub are best effort
when exactly-once delivery is disabled, the message may be re-delivered
within the set deadline.
Exactly once delivery is a preview feature. For more details,
see https://cloud.google.com/pubsub/docs/exactly-once-delivery."

Args:
seconds:
Expand Down Expand Up @@ -434,15 +443,18 @@ def nack_with_response(self) -> "futures.Future":
may take place immediately or after a delay, and may arrive at this subscriber
or another.

If exactly-once delivery is NOT enabled on the subscription, the
future returns immediately with an AcknowledgeStatus.SUCCESS.

If exactly-once delivery is enabled on the subscription, the
future returned by this method tracks the state of the
nack operation. If the future completes successfully,
the future's result will be an AcknowledgeStatus.SUCCESS.
Otherwise, the future will contain an exception with more details about
the failure.

If exactly-once delivery is NOT enabled on the subscription, the
future returns immediately with an AcknowledgeStatus.SUCCESS.
Exactly once delivery is a preview feature. For more details,
see https://cloud.google.com/pubsub/docs/exactly-once-delivery."

Returns:
A :class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
Expand Down
9 changes: 1 addition & 8 deletions google/pubsub_v1/services/publisher/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from collections import OrderedDict
import functools
import re
from typing import Dict, Optional, Sequence, Tuple, Type, Union
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
import pkg_resources

from google.api_core.client_options import ClientOptions
Expand Down Expand Up @@ -220,7 +220,6 @@ async def create_topic(
name rules]
(https://cloud.google.com/pubsub/docs/admin#resource_names).


.. code-block:: python

from google import pubsub_v1
Expand Down Expand Up @@ -329,7 +328,6 @@ async def update_topic(
r"""Updates an existing topic. Note that certain
properties of a topic are not modifiable.


.. code-block:: python

from google import pubsub_v1
Expand Down Expand Up @@ -418,7 +416,6 @@ async def publish(
r"""Adds one or more messages to the topic. Returns ``NOT_FOUND`` if
the topic does not exist.


.. code-block:: python

from google import pubsub_v1
Expand Down Expand Up @@ -758,7 +755,6 @@ async def list_topic_subscriptions(
r"""Lists the names of the attached subscriptions on this
topic.


.. code-block:: python

from google import pubsub_v1
Expand Down Expand Up @@ -884,7 +880,6 @@ async def list_topic_snapshots(
bulk. That is, you can set the acknowledgment state of messages
in an existing subscription to the state captured by a snapshot.


.. code-block:: python

from google import pubsub_v1
Expand Down Expand Up @@ -1010,7 +1005,6 @@ async def delete_topic(
subscriptions to this topic are not deleted, but their ``topic``
field is set to ``_deleted-topic_``.


.. code-block:: python

from google import pubsub_v1
Expand Down Expand Up @@ -1107,7 +1101,6 @@ async def detach_subscription(
the subscription is a push subscription, pushes to the endpoint
will stop.


.. code-block:: python

from google import pubsub_v1
Expand Down
9 changes: 1 addition & 8 deletions google/pubsub_v1/services/publisher/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import functools
import os
import re
from typing import Dict, Optional, Sequence, Tuple, Type, Union
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
import pkg_resources

from google.api_core import client_options as client_options_lib
Expand Down Expand Up @@ -503,7 +503,6 @@ def create_topic(
name rules]
(https://cloud.google.com/pubsub/docs/admin#resource_names).


.. code-block:: python

from google import pubsub_v1
Expand Down Expand Up @@ -604,7 +603,6 @@ def update_topic(
r"""Updates an existing topic. Note that certain
properties of a topic are not modifiable.


.. code-block:: python

from google import pubsub_v1
Expand Down Expand Up @@ -686,7 +684,6 @@ def publish(
r"""Adds one or more messages to the topic. Returns ``NOT_FOUND`` if
the topic does not exist.


.. code-block:: python

from google import pubsub_v1
Expand Down Expand Up @@ -992,7 +989,6 @@ def list_topic_subscriptions(
r"""Lists the names of the attached subscriptions on this
topic.


.. code-block:: python

from google import pubsub_v1
Expand Down Expand Up @@ -1108,7 +1104,6 @@ def list_topic_snapshots(
bulk. That is, you can set the acknowledgment state of messages
in an existing subscription to the state captured by a snapshot.


.. code-block:: python

from google import pubsub_v1
Expand Down Expand Up @@ -1224,7 +1219,6 @@ def delete_topic(
subscriptions to this topic are not deleted, but their ``topic``
field is set to ``_deleted-topic_``.


.. code-block:: python

from google import pubsub_v1
Expand Down Expand Up @@ -1313,7 +1307,6 @@ def detach_subscription(
the subscription is a push subscription, pushes to the endpoint
will stop.


.. code-block:: python

from google import pubsub_v1
Expand Down
5 changes: 5 additions & 0 deletions google/pubsub_v1/services/publisher/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def __init__(
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
"""

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
Expand Down Expand Up @@ -391,5 +392,9 @@ def test_iam_permissions(
]:
raise NotImplementedError()

@property
def kind(self) -> str:
raise NotImplementedError()


__all__ = ("PublisherTransport",)
4 changes: 4 additions & 0 deletions google/pubsub_v1/services/publisher/transports/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,5 +565,9 @@ def test_iam_permissions(
def close(self):
self.grpc_channel.close()

@property
def kind(self) -> str:
return "grpc"


__all__ = ("PublisherGrpcTransport",)
2 changes: 1 addition & 1 deletion google/pubsub_v1/services/schema_service/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from collections import OrderedDict
import functools
import re
from typing import Dict, Optional, Sequence, Tuple, Type, Union
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
import pkg_resources

from google.api_core.client_options import ClientOptions
Expand Down
2 changes: 1 addition & 1 deletion google/pubsub_v1/services/schema_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from collections import OrderedDict
import os
import re
from typing import Dict, Optional, Sequence, Tuple, Type, Union
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
import pkg_resources

from google.api_core import client_options as client_options_lib
Expand Down
5 changes: 5 additions & 0 deletions google/pubsub_v1/services/schema_service/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def __init__(
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
"""

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
Expand Down Expand Up @@ -255,5 +256,9 @@ def test_iam_permissions(
]:
raise NotImplementedError()

@property
def kind(self) -> str:
raise NotImplementedError()


__all__ = ("SchemaServiceTransport",)
4 changes: 4 additions & 0 deletions google/pubsub_v1/services/schema_service/transports/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,5 +468,9 @@ def test_iam_permissions(
def close(self):
self.grpc_channel.close()

@property
def kind(self) -> str:
return "grpc"


__all__ = ("SchemaServiceGrpcTransport",)
Loading