Skip to content
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
13 changes: 9 additions & 4 deletions sdk/eventhub/azure-eventhub/azure/eventhub/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,13 @@ def system_properties(self):
def body(self):
# type: () -> Any
"""The body of the Message. The format may vary depending on the body type:
For ~azure.eventhub.AmqpMessageBodyType.DATA, the body could be bytes or Iterable[bytes]
For ~azure.eventhub.AmqpMessageBodyType.SEQUENCE, the body could be List or Iterable[List]
For ~azure.eventhub.AmqpMessageBodyType.VALUE, the body could be any type.
For :class:`azure.eventhub.amqp.AmqpMessageBodyType.DATA<azure.eventhub.amqp.AmqpMessageBodyType.DATA>`,
the body could be bytes or Iterable[bytes].
For :class:`azure.eventhub.amqp.AmqpMessageBodyType.SEQUENCE<azure.eventhub.amqp.AmqpMessageBodyType.SEQUENCE>`,
the body could be List or Iterable[List].
For :class:`azure.eventhub.amqp.AmqpMessageBodyType.VALUE<azure.eventhub.amqp.AmqpMessageBodyType.VALUE>`,
the body could be any type.

:rtype: Any
"""
try:
Expand All @@ -333,7 +337,8 @@ def body(self):
def body_type(self):
# type: () -> AmqpMessageBodyType
"""The body type of the underlying AMQP message.
rtype: ~azure.servicebus.amqp.AmqpMessageBodyType

:rtype: ~azure.eventhub.amqp.AmqpMessageBodyType
"""
return self._raw_amqp_message.body_type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ class AmqpAnnotatedMessage(object):
access to low-level AMQP message sections. There should be one and only one of either data_body, sequence_body
or value_body being set as the body of the AmqpAnnotatedMessage; if more than one body is set, `ValueError` will
be raised.

Please refer to the AMQP spec:
http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format
for more information on the message format.

:keyword data_body: The body consists of one or more data sections and each section contains opaque binary data.
:paramtype data_body: Union[str, bytes, List[Union[str, bytes]]]
:keyword sequence_body: The body consists of one or more sequence sections and
Expand Down Expand Up @@ -268,9 +270,13 @@ def _to_outgoing_amqp_message(self):
def body(self):
# type: () -> Any
"""The body of the Message. The format may vary depending on the body type:
For ~azure.eventhub.AmqpMessageBodyType.DATA, the body could be bytes or Iterable[bytes]
For ~azure.eventhub.AmqpMessageBodyType.SEQUENCE, the body could be List or Iterable[List]
For ~azure.eventhub.AmqpMessageBodyType.VALUE, the body could be any type.
For :class:`azure.eventhub.amqp.AmqpMessageBodyType.DATA<azure.eventhub.amqp.AmqpMessageBodyType.DATA>`,
the body could be bytes or Iterable[bytes].
For :class:`azure.eventhub.amqp.AmqpMessageBodyType.SEQUENCE<azure.eventhub.amqp.AmqpMessageBodyType.SEQUENCE>`,
the body could be List or Iterable[List].
For :class:`azure.eventhub.amqp.AmqpMessageBodyType.VALUE<azure.eventhub.amqp.AmqpMessageBodyType.VALUE>`,
the body could be any type.

:rtype: Any
"""
return self._message.get_data()
Expand All @@ -279,7 +285,8 @@ def body(self):
def body_type(self):
# type: () -> AmqpMessageBodyType
"""The body type of the underlying AMQP message.
rtype: ~azure.eventhub.amqp.AmqpMessageBodyType

:rtype: ~azure.eventhub.amqp.AmqpMessageBodyType
"""
return AMQP_MESSAGE_BODY_TYPE_MAP.get(
self._message._body.type, AmqpMessageBodyType.VALUE # pylint: disable=protected-access
Expand All @@ -290,6 +297,7 @@ def properties(self):
# type: () -> Optional[AmqpMessageProperties]
"""
Properties to add to the message.

:rtype: Optional[~azure.eventhub.amqp.AmqpMessageProperties]
"""
return self._properties
Expand All @@ -304,6 +312,7 @@ def application_properties(self):
# type: () -> Optional[dict]
"""
Service specific application properties.

:rtype: Optional[dict]
"""
return self._application_properties
Expand All @@ -318,6 +327,7 @@ def annotations(self):
# type: () -> Optional[dict]
"""
Service specific message annotations.

:rtype: Optional[dict]
"""
return self._annotations
Expand All @@ -333,6 +343,7 @@ def delivery_annotations(self):
"""
Delivery-specific non-standard properties at the head of the message.
Delivery annotations convey information from the sending peer to the receiving peer.

:rtype: dict
"""
return self._delivery_annotations
Expand All @@ -347,6 +358,7 @@ def header(self):
# type: () -> Optional[AmqpMessageHeader]
"""
The message header.

:rtype: Optional[~azure.eventhub.amqp.AmqpMessageHeader]
"""
return self._header
Expand All @@ -361,6 +373,7 @@ def footer(self):
# type: () -> Optional[dict]
"""
The message footer.

:rtype: Optional[dict]
"""
return self._footer
Expand All @@ -369,17 +382,18 @@ def footer(self):
def footer(self, value):
# type: (dict) -> None
self._footer = value
# self._message.footer = value


class AmqpMessageHeader(DictMixin):
"""The Message header.
The Message header. This is only used on received message, and not
set on messages being sent. The properties set on any given message
will depend on the Service and not all messages will have all properties.

Please refer to the AMQP spec:
http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-header
for more information on the message header.

:keyword delivery_count: The number of unsuccessful previous attempts to deliver
this message. If this value is non-zero it can be taken as an indication that the
delivery might be a duplicate. On first delivery, the value is zero. It is
Expand Down Expand Up @@ -449,9 +463,11 @@ class AmqpMessageProperties(DictMixin):
The properties that are actually used will depend on the service implementation.
Not all received messages will have all properties, and not all properties
will be utilized on a sent message.

Please refer to the AMQP spec:
http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-properties
for more information on the message properties.

:keyword message_id: Message-id, if set, uniquely identifies a message within the message system.
The message producer is usually responsible for setting the message-id in such a way that it
is assured to be globally unique. A broker MAY discard a message as a duplicate if the value
Expand Down
2 changes: 1 addition & 1 deletion sdk/eventhub/azure-eventhub/doc/azure.eventhub.amqp.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
azure.eventhub.amqp package
==========================
===========================

.. autoclass:: azure.eventhub.amqp.AmqpAnnotatedMessage
:members:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,13 @@ def scheduled_enqueue_time_utc(self, value):
def body(self):
# type: () -> Any
"""The body of the Message. The format may vary depending on the body type:
For ~azure.servicebus.AmqpMessageBodyType.DATA, the body could be bytes or Iterable[bytes]
For ~azure.servicebus.AmqpMessageBodyType.SEQUENCE, the body could be List or Iterable[List]
For ~azure.servicebus.AmqpMessageBodyType.VALUE, the body could be any type.
For :class:`azure.servicebus.amqp.AmqpMessageBodyType.DATA<azure.servicebus.amqp.AmqpMessageBodyType.DATA>`,
the body could be bytes or Iterable[bytes].
For
:class:`azure.servicebus.amqp.AmqpMessageBodyType.SEQUENCE<azure.servicebus.amqp.AmqpMessageBodyType.SEQUENCE>`,
the body could be List or Iterable[List].
For :class:`azure.servicebus.amqp.AmqpMessageBodyType.VALUE<azure.servicebus.amqp.AmqpMessageBodyType.VALUE>`,
the body could be any type.

:rtype: Any
"""
Expand All @@ -411,7 +415,7 @@ def body_type(self):
# type: () -> AmqpMessageBodyType
"""The body type of the underlying AMQP message.

rtype: ~azure.servicebus.amqp.AmqpMessageBodyType
:rtype: ~azure.servicebus.amqp.AmqpMessageBodyType
"""
return self._raw_amqp_message.body_type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class AmqpAnnotatedMessage(object):
access to low-level AMQP message sections. There should be one and only one of either data_body, sequence_body
or value_body being set as the body of the AmqpAnnotatedMessage; if more than one body is set, `ValueError` will
be raised.

Please refer to the AMQP spec:
http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format
for more information on the message format.
Expand Down Expand Up @@ -301,9 +302,13 @@ def _to_outgoing_message(self, message_type):
def body(self):
# type: () -> Any
"""The body of the Message. The format may vary depending on the body type:
For ~azure.servicebus.AmqpMessageBodyType.DATA, the body could be bytes or Iterable[bytes]
For ~azure.servicebus.AmqpMessageBodyType.SEQUENCE, the body could be List or Iterable[List]
For ~azure.servicebus.AmqpMessageBodyType.VALUE, the body could be any type.
For :class:`azure.servicebus.amqp.AmqpMessageBodyType.DATA<azure.servicebus.amqp.AmqpMessageBodyType.DATA>`,
the body could be bytes or Iterable[bytes].
For
:class:`azure.servicebus.amqp.AmqpMessageBodyType.SEQUENCE<azure.servicebus.amqp.AmqpMessageBodyType.SEQUENCE>`,
the body could be List or Iterable[List].
For :class:`azure.servicebus.amqp.AmqpMessageBodyType.VALUE<azure.servicebus.amqp.AmqpMessageBodyType.VALUE>`,
the body could be any type.

:rtype: Any
"""
Expand All @@ -314,7 +319,7 @@ def body_type(self):
# type: () -> AmqpMessageBodyType
"""The body type of the underlying AMQP message.

rtype: ~azure.servicebus.amqp.AmqpMessageBodyType
:rtype: ~azure.servicebus.amqp.AmqpMessageBodyType
"""
return AMQP_MESSAGE_BODY_TYPE_MAP.get(
self._message._body.type, AmqpMessageBodyType.VALUE # pylint: disable=protected-access
Expand Down Expand Up @@ -410,7 +415,6 @@ def footer(self):
def footer(self, value):
# type: (dict) -> None
self._footer = value
# self._message.footer = value


class AmqpMessageHeader(DictMixin):
Expand Down