diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py b/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py index 136ee71efd67..4ccf42e02b12 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/_common.py @@ -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`, + the body could be bytes or Iterable[bytes]. + For :class:`azure.eventhub.amqp.AmqpMessageBodyType.SEQUENCE`, + the body could be List or Iterable[List]. + For :class:`azure.eventhub.amqp.AmqpMessageBodyType.VALUE`, + the body could be any type. + :rtype: Any """ try: @@ -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 diff --git a/sdk/eventhub/azure-eventhub/azure/eventhub/amqp/_amqp_message.py b/sdk/eventhub/azure-eventhub/azure/eventhub/amqp/_amqp_message.py index f793e460a894..500d9797fbb6 100644 --- a/sdk/eventhub/azure-eventhub/azure/eventhub/amqp/_amqp_message.py +++ b/sdk/eventhub/azure-eventhub/azure/eventhub/amqp/_amqp_message.py @@ -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 @@ -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`, + the body could be bytes or Iterable[bytes]. + For :class:`azure.eventhub.amqp.AmqpMessageBodyType.SEQUENCE`, + the body could be List or Iterable[List]. + For :class:`azure.eventhub.amqp.AmqpMessageBodyType.VALUE`, + the body could be any type. + :rtype: Any """ return self._message.get_data() @@ -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 @@ -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 @@ -304,6 +312,7 @@ def application_properties(self): # type: () -> Optional[dict] """ Service specific application properties. + :rtype: Optional[dict] """ return self._application_properties @@ -318,6 +327,7 @@ def annotations(self): # type: () -> Optional[dict] """ Service specific message annotations. + :rtype: Optional[dict] """ return self._annotations @@ -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 @@ -347,6 +358,7 @@ def header(self): # type: () -> Optional[AmqpMessageHeader] """ The message header. + :rtype: Optional[~azure.eventhub.amqp.AmqpMessageHeader] """ return self._header @@ -361,6 +373,7 @@ def footer(self): # type: () -> Optional[dict] """ The message footer. + :rtype: Optional[dict] """ return self._footer @@ -369,7 +382,6 @@ def footer(self): def footer(self, value): # type: (dict) -> None self._footer = value - # self._message.footer = value class AmqpMessageHeader(DictMixin): @@ -377,9 +389,11 @@ class AmqpMessageHeader(DictMixin): 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 @@ -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 diff --git a/sdk/eventhub/azure-eventhub/doc/azure.eventhub.amqp.rst b/sdk/eventhub/azure-eventhub/doc/azure.eventhub.amqp.rst index 274420e27812..7c4ec42df81c 100644 --- a/sdk/eventhub/azure-eventhub/doc/azure.eventhub.amqp.rst +++ b/sdk/eventhub/azure-eventhub/doc/azure.eventhub.amqp.rst @@ -1,5 +1,5 @@ azure.eventhub.amqp package -========================== +=========================== .. autoclass:: azure.eventhub.amqp.AmqpAnnotatedMessage :members: diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py b/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py index 3d92b085dece..856ea8a7e0c8 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py @@ -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`, + the body could be bytes or Iterable[bytes]. + For + :class:`azure.servicebus.amqp.AmqpMessageBodyType.SEQUENCE`, + the body could be List or Iterable[List]. + For :class:`azure.servicebus.amqp.AmqpMessageBodyType.VALUE`, + the body could be any type. :rtype: Any """ @@ -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 diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/amqp/_amqp_message.py b/sdk/servicebus/azure-servicebus/azure/servicebus/amqp/_amqp_message.py index 9484262c5cea..ec60df31e3cc 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/amqp/_amqp_message.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/amqp/_amqp_message.py @@ -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. @@ -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`, + the body could be bytes or Iterable[bytes]. + For + :class:`azure.servicebus.amqp.AmqpMessageBodyType.SEQUENCE`, + the body could be List or Iterable[List]. + For :class:`azure.servicebus.amqp.AmqpMessageBodyType.VALUE`, + the body could be any type. :rtype: Any """ @@ -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 @@ -410,7 +415,6 @@ def footer(self): def footer(self, value): # type: (dict) -> None self._footer = value - # self._message.footer = value class AmqpMessageHeader(DictMixin):