From cb13bd8718a487427e66cbd3324e170da2163025 Mon Sep 17 00:00:00 2001 From: yijxie Date: Fri, 14 Feb 2020 11:23:21 -0800 Subject: [PATCH 01/10] Increment version --- .../azure-eventhub-checkpointstoreblob-aio/CHANGELOG.md | 2 ++ .../eventhub/extensions/checkpointstoreblobaio/_version.py | 2 +- sdk/eventhub/azure-eventhub-checkpointstoreblob/CHANGELOG.md | 2 ++ .../azure/eventhub/extensions/checkpointstoreblob/_version.py | 2 +- sdk/eventhub/azure-eventhub/CHANGELOG.md | 2 ++ sdk/eventhub/azure-eventhub/azure/eventhub/_version.py | 2 +- 6 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/CHANGELOG.md b/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/CHANGELOG.md index 8e929a30f01f..4d6010a3249a 100644 --- a/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/CHANGELOG.md +++ b/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/CHANGELOG.md @@ -1,5 +1,7 @@ # Release History +## 1.0.1 (Unreleased) + ## 1.0.0 (2020-01-13) Stable release. No new features or API changes. diff --git a/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_version.py b/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_version.py index 8eedef9ba349..010063f9dd93 100644 --- a/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_version.py +++ b/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_version.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. # ------------------------------------ -VERSION = "1.0.0" +VERSION = "1.0.1" diff --git a/sdk/eventhub/azure-eventhub-checkpointstoreblob/CHANGELOG.md b/sdk/eventhub/azure-eventhub-checkpointstoreblob/CHANGELOG.md index 2498f3200d83..bbae3dace509 100644 --- a/sdk/eventhub/azure-eventhub-checkpointstoreblob/CHANGELOG.md +++ b/sdk/eventhub/azure-eventhub-checkpointstoreblob/CHANGELOG.md @@ -1,5 +1,7 @@ # Release History +## 1.0.1 (Unreleased) + ## 1.0.0 (2020-01-13) Stable release. No new features or API changes. diff --git a/sdk/eventhub/azure-eventhub-checkpointstoreblob/azure/eventhub/extensions/checkpointstoreblob/_version.py b/sdk/eventhub/azure-eventhub-checkpointstoreblob/azure/eventhub/extensions/checkpointstoreblob/_version.py index 8eedef9ba349..010063f9dd93 100644 --- a/sdk/eventhub/azure-eventhub-checkpointstoreblob/azure/eventhub/extensions/checkpointstoreblob/_version.py +++ b/sdk/eventhub/azure-eventhub-checkpointstoreblob/azure/eventhub/extensions/checkpointstoreblob/_version.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. # ------------------------------------ -VERSION = "1.0.0" +VERSION = "1.0.1" diff --git a/sdk/eventhub/azure-eventhub/CHANGELOG.md b/sdk/eventhub/azure-eventhub/CHANGELOG.md index 6e48b02ca198..43675644db6b 100644 --- a/sdk/eventhub/azure-eventhub/CHANGELOG.md +++ b/sdk/eventhub/azure-eventhub/CHANGELOG.md @@ -1,5 +1,7 @@ # Release History +## 5.0.1 (Unreleased) + ## 5.0.0 (2020-01-13) **Breaking changes** diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_version.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_version.py index 7330e03f2b28..aeddf5ca4e16 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_version.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_version.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. # ------------------------------------ -VERSION = "5.0.0" +VERSION = "5.0.1" From 38e9f65493683c04c69040b11433dd6b02017f98 Mon Sep 17 00:00:00 2001 From: yijxie Date: Fri, 14 Feb 2020 11:23:39 -0800 Subject: [PATCH 02/10] Update Development Status --- sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/setup.py | 2 +- sdk/eventhub/azure-eventhub-checkpointstoreblob/setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/setup.py b/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/setup.py index 0b13ff1bbb0f..88f1fd79f107 100644 --- a/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/setup.py +++ b/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/setup.py @@ -53,7 +53,7 @@ author_email='azpysdkhelp@microsoft.com', url='https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub-checkpointstoreblob-aio', classifiers=[ - 'Development Status :: 3 - Alpha', + 'Development Status :: 5 - Production/Stable', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', diff --git a/sdk/eventhub/azure-eventhub-checkpointstoreblob/setup.py b/sdk/eventhub/azure-eventhub-checkpointstoreblob/setup.py index a6bbf648336d..40f6e926ed84 100644 --- a/sdk/eventhub/azure-eventhub-checkpointstoreblob/setup.py +++ b/sdk/eventhub/azure-eventhub-checkpointstoreblob/setup.py @@ -53,7 +53,7 @@ author_email='azpysdkhelp@microsoft.com', url='https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub-checkpointstoreblob', classifiers=[ - 'Development Status :: 3 - Alpha', + 'Development Status :: 5 - Production/Stable', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', From fcbaf65ae5f4ead7635c4595d67f5281f98ecded Mon Sep 17 00:00:00 2001 From: yijxie Date: Mon, 9 Mar 2020 15:44:12 -0700 Subject: [PATCH 03/10] Remove typing.Deque for Py3.5.3 --- sdk/eventhub/azure-eventhub/azure/eventhub/_consumer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer.py index b5e58ae6e803..6203ae636201 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_consumer.py @@ -7,7 +7,7 @@ import uuid import logging from collections import deque -from typing import TYPE_CHECKING, Callable, Dict, Optional, Any, Deque +from typing import TYPE_CHECKING, Callable, Dict, Optional, Any import uamqp from uamqp import types, errors, utils @@ -120,7 +120,7 @@ def __init__(self, client, source, **kwargs): self._track_last_enqueued_event_properties = ( track_last_enqueued_event_properties ) - self._message_buffer = deque() # type: Deque[uamqp.Message] + self._message_buffer = deque() # type: ignore self._last_received_event = None # type: Optional[EventData] def _create_handler(self, auth): From 8c7657334ce0fc9599f805a840099750d91c1c6e Mon Sep 17 00:00:00 2001 From: yijxie Date: Wed, 25 Mar 2020 13:23:50 -0700 Subject: [PATCH 04/10] Copy uamqp.Message.properties to EventData.system_properties --- .../azure-eventhub/azure/eventhub/_common.py | 36 ++++++++++++++++- .../azure/eventhub/_constants.py | 14 +++++++ .../tests/unittest/test_event_data.py | 39 ++++++++++++++++++- 3 files changed, 86 insertions(+), 3 deletions(-) diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py index 78bf705add9f..631eb89138f9 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py @@ -29,6 +29,19 @@ PROP_PARTITION_KEY, PROP_PARTITION_KEY_AMQP_SYMBOL, PROP_TIMESTAMP, + PROP_ABSOLUTE_EXPIRY_TIME, + PROP_CONTENT_ENCODING, + PROP_CONTENT_TYPE, + PROP_CORRELATION_ID, + PROP_GROUP_ID, + PROP_GROUP_SEQUENCE, + PROP_MESSAGE_ID, + PROP_REPLY_TO, + PROP_REPLY_TO_GROUP_ID, + PROP_SUBJECT, + PROP_TO, + PROP_USER_ID, + PROP_CREATION_TIME, ) if TYPE_CHECKING: @@ -60,6 +73,7 @@ class EventData(object): def __init__(self, body=None): # type: (Union[str, bytes, List[AnyStr]]) -> None self._last_enqueued_event_properties = {} # type: Dict[str, Any] + self._sys_properties = None # type: Optional[Dict[bytes, Any]] if body and isinstance(body, list): self.message = Message(body[0]) for more in body[1:]: @@ -207,12 +221,30 @@ def properties(self, value): @property def system_properties(self): - # type: () -> Dict[Union[str, bytes], Any] + # type: () -> Dict[bytes, Any] """Metadata set by the Event Hubs Service associated with the event :rtype: dict """ - return self.message.annotations + + if not self._sys_properties: + self._sys_properties = { + PROP_MESSAGE_ID: self.message.properties.message_id, + PROP_USER_ID: self.message.properties.user_id, + PROP_TO: self.message.properties.to, + PROP_SUBJECT: self.message.properties.subject, + PROP_REPLY_TO: self.message.properties.reply_to, + PROP_CORRELATION_ID: self.message.properties.correlation_id, + PROP_CONTENT_TYPE: self.message.properties.content_type, + PROP_CONTENT_ENCODING: self.message.properties.content_encoding, + PROP_ABSOLUTE_EXPIRY_TIME: self.message.properties.absolute_expiry_time, + PROP_CREATION_TIME: self.message.properties.creation_time, + PROP_GROUP_ID: self.message.properties.group_id, + PROP_GROUP_SEQUENCE: self.message.properties.group_sequence, + PROP_REPLY_TO_GROUP_ID: self.message.properties.reply_to_group_id, + } + self._sys_properties.update(self.message.annotations) + return self._sys_properties @property def body(self): diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py index b6466b63ef0b..eb299e8121b4 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py @@ -17,6 +17,20 @@ PROP_LAST_ENQUEUED_TIME_UTC = b"last_enqueued_time_utc" PROP_RUNTIME_INFO_RETRIEVAL_TIME_UTC = b"runtime_info_retrieval_time_utc" +PROP_MESSAGE_ID = b"message_id" +PROP_USER_ID = b"user_id" +PROP_TO = b"to" +PROP_SUBJECT = b"subject" +PROP_REPLY_TO = b"reply_to" +PROP_CORRELATION_ID = b"correlation_id" +PROP_CONTENT_TYPE = b"content_type" +PROP_CONTENT_ENCODING = b"content_encoding" +PROP_ABSOLUTE_EXPIRY_TIME = b"absolute_expiry_time" +PROP_CREATION_TIME = b"creation_time" +PROP_GROUP_ID = b"group_id" +PROP_GROUP_SEQUENCE = b"group_sequence" +PROP_REPLY_TO_GROUP_ID = b"reply_to_group_id" + EPOCH_SYMBOL = b"com.microsoft:epoch" TIMEOUT_SYMBOL = b"com.microsoft:timeout" RECEIVER_RUNTIME_METRIC_SYMBOL = b"com.microsoft:enable-receiver-runtime-metric" diff --git a/sdk/eventhub/azure-eventhub/tests/unittest/test_event_data.py b/sdk/eventhub/azure-eventhub/tests/unittest/test_event_data.py index a797a281b857..d8fa927bffd0 100644 --- a/sdk/eventhub/azure-eventhub/tests/unittest/test_event_data.py +++ b/sdk/eventhub/azure-eventhub/tests/unittest/test_event_data.py @@ -1,6 +1,6 @@ import platform import pytest - +import uamqp pytestmark = pytest.mark.skipif(platform.python_implementation() == "PyPy", reason="This is ignored for PyPy") @@ -52,6 +52,43 @@ def test_app_properties(): assert event_data.properties["a"] == "b" +def test_sys_properties(): + import datetime + from azure.eventhub import _common + properties = uamqp.message.MessageProperties() + properties.message_id = "message_id" + properties.user_id = "user_id" + properties.to = "to" + properties.subject = "subject" + properties.reply_to = "reply_to" + properties.correlation_id = "correlation_id" + properties.content_type = "content_type" + properties.content_encoding = "content_encoding" + properties.absolute_expiry_time = 1 + properties.creation_time = 1 + properties.group_id = "group_id" + properties.group_sequence = 1 + properties.reply_to_group_id = "reply_to_group_id" + message = uamqp.Message(properties=properties) + message.annotations = {_common.PROP_OFFSET: "@latest"} + ed = EventData._from_message(message) # type: EventData + + assert ed.system_properties[_common.PROP_OFFSET] == "@latest" + assert ed.system_properties[_common.PROP_CORRELATION_ID] == properties.correlation_id + assert ed.system_properties[_common.PROP_MESSAGE_ID] == properties.message_id + assert ed.system_properties[_common.PROP_CONTENT_ENCODING] == properties.content_encoding + assert ed.system_properties[_common.PROP_CONTENT_TYPE] == properties.content_type + assert ed.system_properties[_common.PROP_USER_ID] == properties.user_id + assert ed.system_properties[_common.PROP_TO] == properties.to + assert ed.system_properties[_common.PROP_SUBJECT] == properties.subject + assert ed.system_properties[_common.PROP_REPLY_TO] == properties.reply_to + assert ed.system_properties[_common.PROP_ABSOLUTE_EXPIRY_TIME] == properties.absolute_expiry_time + assert ed.system_properties[_common.PROP_CREATION_TIME] == properties.creation_time + assert ed.system_properties[_common.PROP_GROUP_ID] == properties.group_id + assert ed.system_properties[_common.PROP_GROUP_SEQUENCE] == properties.group_sequence + assert ed.system_properties[_common.PROP_REPLY_TO_GROUP_ID] == properties.reply_to_group_id + + def test_event_data_batch(): batch = EventDataBatch(max_size_in_bytes=100, partition_key="par") batch.add(EventData("A")) From 55141187c5f1433831453c2459e291aa8829ab3f Mon Sep 17 00:00:00 2001 From: yijxie Date: Wed, 25 Mar 2020 13:28:04 -0700 Subject: [PATCH 05/10] Remove unused import --- sdk/eventhub/azure-eventhub/tests/unittest/test_event_data.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/eventhub/azure-eventhub/tests/unittest/test_event_data.py b/sdk/eventhub/azure-eventhub/tests/unittest/test_event_data.py index d8fa927bffd0..50502563681c 100644 --- a/sdk/eventhub/azure-eventhub/tests/unittest/test_event_data.py +++ b/sdk/eventhub/azure-eventhub/tests/unittest/test_event_data.py @@ -1,6 +1,7 @@ import platform import pytest import uamqp +from azure.eventhub import _common pytestmark = pytest.mark.skipif(platform.python_implementation() == "PyPy", reason="This is ignored for PyPy") @@ -53,8 +54,6 @@ def test_app_properties(): def test_sys_properties(): - import datetime - from azure.eventhub import _common properties = uamqp.message.MessageProperties() properties.message_id = "message_id" properties.user_id = "user_id" From c94851cd99e81b556fadeda1f78e223cb6630a5f Mon Sep 17 00:00:00 2001 From: yijxie Date: Wed, 25 Mar 2020 15:01:27 -0700 Subject: [PATCH 06/10] Use - instead of _ to align all system properties --- .../azure/eventhub/_constants.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py index eb299e8121b4..d4c6c1b2ffce 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py @@ -17,19 +17,19 @@ PROP_LAST_ENQUEUED_TIME_UTC = b"last_enqueued_time_utc" PROP_RUNTIME_INFO_RETRIEVAL_TIME_UTC = b"runtime_info_retrieval_time_utc" -PROP_MESSAGE_ID = b"message_id" -PROP_USER_ID = b"user_id" +PROP_MESSAGE_ID = b"message-id" +PROP_USER_ID = b"user-id" PROP_TO = b"to" PROP_SUBJECT = b"subject" -PROP_REPLY_TO = b"reply_to" -PROP_CORRELATION_ID = b"correlation_id" -PROP_CONTENT_TYPE = b"content_type" -PROP_CONTENT_ENCODING = b"content_encoding" -PROP_ABSOLUTE_EXPIRY_TIME = b"absolute_expiry_time" -PROP_CREATION_TIME = b"creation_time" -PROP_GROUP_ID = b"group_id" -PROP_GROUP_SEQUENCE = b"group_sequence" -PROP_REPLY_TO_GROUP_ID = b"reply_to_group_id" +PROP_REPLY_TO = b"reply-to" +PROP_CORRELATION_ID = b"correlation-id" +PROP_CONTENT_TYPE = b"content-type" +PROP_CONTENT_ENCODING = b"content-encoding" +PROP_ABSOLUTE_EXPIRY_TIME = b"absolute-expiry-time" +PROP_CREATION_TIME = b"creation-time" +PROP_GROUP_ID = b"group-id" +PROP_GROUP_SEQUENCE = b"group-sequence" +PROP_REPLY_TO_GROUP_ID = b"reply-to-group_id" EPOCH_SYMBOL = b"com.microsoft:epoch" TIMEOUT_SYMBOL = b"com.microsoft:timeout" From 105ed1c353ddba05d433056f400f16b694687bdf Mon Sep 17 00:00:00 2001 From: yijxie Date: Thu, 26 Mar 2020 10:11:12 -0700 Subject: [PATCH 07/10] Correct a sys property key name --- sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py index d4c6c1b2ffce..97a614c341b5 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_constants.py @@ -29,7 +29,7 @@ PROP_CREATION_TIME = b"creation-time" PROP_GROUP_ID = b"group-id" PROP_GROUP_SEQUENCE = b"group-sequence" -PROP_REPLY_TO_GROUP_ID = b"reply-to-group_id" +PROP_REPLY_TO_GROUP_ID = b"reply-to-group-id" EPOCH_SYMBOL = b"com.microsoft:epoch" TIMEOUT_SYMBOL = b"com.microsoft:timeout" From 77da135bddc3621fd5fa7de40592526913699c08 Mon Sep 17 00:00:00 2001 From: yijxie Date: Thu, 26 Mar 2020 10:30:41 -0700 Subject: [PATCH 08/10] Update docstring of EventData.system_properties --- .../azure-eventhub/azure/eventhub/_common.py | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py index 631eb89138f9..e6f174c1803c 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py @@ -222,7 +222,28 @@ def properties(self, value): @property def system_properties(self): # type: () -> Dict[bytes, Any] - """Metadata set by the Event Hubs Service associated with the event + """Metadata set by the Event Hubs Service associated with the event. + + An EventData could have some or all of the following meta data depending on the source + of the event data. + + - b"x-opt-sequence-number" (int) + - b"x-opt-offset" (bytes) + - b"x-opt-partition-key" (bytes) + - b"x-opt-enqueued-time" (int) + - b"message-id" (bytes) + - b"user-id" (bytes) + - b"to" (bytes) + - b"subject" (bytes) + - b"reply-to" (bytes) + - b"correlation-id" (bytes) + - b"content-type" (bytes) + - b"content-encoding" (bytes) + - b"absolute-expiry-time" (int) + - b"creation-time" (int) + - b"group-id" (bytes) + - b"group-sequence" (bytes) + - b"reply-to-group-id" (bytes) :rtype: dict """ From 4eef2352a8b844fa88971f66b3d671dd9762af5d Mon Sep 17 00:00:00 2001 From: yijxie Date: Thu, 26 Mar 2020 13:30:37 -0700 Subject: [PATCH 09/10] Fix a unit test bug --- .../azure-eventhub/azure/eventhub/_common.py | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py index e6f174c1803c..8119680667fa 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py @@ -52,6 +52,22 @@ # event_data.encoded_size < 255, batch encode overhead is 5, >=256, overhead is 8 each _BATCH_MESSAGE_OVERHEAD_COST = [5, 8] +_SYS_PROP_KEYS_TO_MSG_PROPERTIES = ( + (PROP_MESSAGE_ID, "message_id"), + (PROP_USER_ID, "user_id"), + (PROP_TO, "to"), + (PROP_SUBJECT,"subject"), + (PROP_REPLY_TO, "reply_to"), + (PROP_CORRELATION_ID, "correlation_id"), + (PROP_CONTENT_TYPE, "content_type"), + (PROP_CONTENT_ENCODING, "content_encoding"), + (PROP_ABSOLUTE_EXPIRY_TIME, "absolute_expiry_time"), + (PROP_CREATION_TIME, "creation_time"), + (PROP_GROUP_ID, "group_id"), + (PROP_GROUP_SEQUENCE, "group_sequence"), + (PROP_REPLY_TO_GROUP_ID, "reply_to_group_id"), +) + class EventData(object): """The EventData class is a container for event content. @@ -248,22 +264,13 @@ def system_properties(self): :rtype: dict """ - if not self._sys_properties: - self._sys_properties = { - PROP_MESSAGE_ID: self.message.properties.message_id, - PROP_USER_ID: self.message.properties.user_id, - PROP_TO: self.message.properties.to, - PROP_SUBJECT: self.message.properties.subject, - PROP_REPLY_TO: self.message.properties.reply_to, - PROP_CORRELATION_ID: self.message.properties.correlation_id, - PROP_CONTENT_TYPE: self.message.properties.content_type, - PROP_CONTENT_ENCODING: self.message.properties.content_encoding, - PROP_ABSOLUTE_EXPIRY_TIME: self.message.properties.absolute_expiry_time, - PROP_CREATION_TIME: self.message.properties.creation_time, - PROP_GROUP_ID: self.message.properties.group_id, - PROP_GROUP_SEQUENCE: self.message.properties.group_sequence, - PROP_REPLY_TO_GROUP_ID: self.message.properties.reply_to_group_id, - } + if self._sys_properties is None: + self._sys_properties = {} + if self.message.properties: + for key, prop_name in _SYS_PROP_KEYS_TO_MSG_PROPERTIES: + value = getattr(self.message.properties, prop_name, None) + if value: + self._sys_properties[key] = value self._sys_properties.update(self.message.annotations) return self._sys_properties From f4021c9f782b7168f8f432357c39759891d7963b Mon Sep 17 00:00:00 2001 From: yijxie Date: Thu, 26 Mar 2020 13:34:25 -0700 Subject: [PATCH 10/10] fix a pylint error --- sdk/eventhub/azure-eventhub/azure/eventhub/_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py index 8119680667fa..74491e4dff99 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py @@ -56,7 +56,7 @@ (PROP_MESSAGE_ID, "message_id"), (PROP_USER_ID, "user_id"), (PROP_TO, "to"), - (PROP_SUBJECT,"subject"), + (PROP_SUBJECT, "subject"), (PROP_REPLY_TO, "reply_to"), (PROP_CORRELATION_ID, "correlation_id"), (PROP_CONTENT_TYPE, "content_type"),