Skip to content

Service bus delivery count #26

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

Merged
merged 2 commits into from
Sep 10, 2019
Merged
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
6 changes: 6 additions & 0 deletions azure/functions/_servicebus.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ def correlation_id(self) -> typing.Optional[str]:
"""Message correlation identifier."""
pass

@property
@abc.abstractmethod
def delivery_count(self) -> typing.Optional[int]:
"""Number of times delivery has been attempted."""
pass

@property
@abc.abstractmethod
def expiration_time(self) -> typing.Optional[datetime.datetime]:
Expand Down
8 changes: 8 additions & 0 deletions azure/functions/servicebus.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(
body: bytes,
content_type: typing.Optional[str]=None,
correlation_id: typing.Optional[str]=None,
delivery_count: typing.Optional[int]=0,
expiration_time: typing.Optional[datetime.datetime]=None,
label: typing.Optional[str]=None,
message_id: str,
Expand All @@ -29,6 +30,7 @@ def __init__(
self.__body = body
self.__content_type = content_type
self.__correlation_id = correlation_id
self.__delivery_count = delivery_count
self.__expiration_time = expiration_time
self.__label = label
self.__message_id = message_id
Expand All @@ -52,6 +54,10 @@ def content_type(self) -> typing.Optional[str]:
def correlation_id(self) -> typing.Optional[str]:
return self.__correlation_id

@property
def delivery_count(self) -> typing.Optional[int]:
return self.__delivery_count

@property
def expiration_time(self) -> typing.Optional[datetime.datetime]:
return self.__expiration_time
Expand Down Expand Up @@ -143,6 +149,8 @@ def decode(cls, data: meta.Datum, *,
trigger_metadata, 'ContentType', python_type=str),
correlation_id=cls._decode_trigger_metadata_field(
trigger_metadata, 'CorrelationId', python_type=str),
delivery_count=cls._decode_trigger_metadata_field(
trigger_metadata, 'DeliveryCount', python_type=int),
expiration_time=cls._parse_datetime_metadata(
trigger_metadata, 'ExpirationTime'),
label=cls._decode_trigger_metadata_field(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='azure-functions',
version='1.0.3',
version='1.0.4',
description='Azure Functions for Python',
author='Microsoft Corporation',
author_email='[email protected]',
Expand Down