diff --git a/sdk/eventhub/azure-eventhubs/HISTORY.md b/sdk/eventhub/azure-eventhubs/HISTORY.md index f0577a7640d9..85fc63509e55 100644 --- a/sdk/eventhub/azure-eventhubs/HISTORY.md +++ b/sdk/eventhub/azure-eventhubs/HISTORY.md @@ -1,10 +1,22 @@ # Release History -## 5.0.0b4 (2019-XX-XX) +## 5.0.0b4 (2019-10-08) **New features** -- Support for tracing #7153 +- Added support for tracing (issue #7153). +- Added the capability of tracking last enqueued event properties of the partition to `EventHubConsumer` . + - Added new boolean type parameter`track_last_enqueued_event_properties` in method `EventHubClient.create_consumer()`. + - Added new property `last_enqueued_event_properties` of on `EventHubConsumer` which contains sequence_number, offset, enqueued_time and retrieval_time information. + - By default the capability is disabled as it will cost extra band width for transferring more information if turned on. + +**Breaking changes** + +- Removed support for IoT Hub direct connection. + - [EventHubs compatible connection string](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-read-builtin) of an IotHub can be used to create `EventHubClient` and read properties or events from an IoT Hub. +- Removed support for sending EventData to IoT Hub. +- Removed parameter `exception` in method `close()` of `EventHubConsumer` and `EventHubProcuer`. +- Updated uAMQP dependency to 1.2.3. ## 5.0.0b3 (2019-09-10) diff --git a/sdk/eventhub/azure-eventhubs/README.md b/sdk/eventhub/azure-eventhubs/README.md index f456159d938f..e4fc68fd38e0 100644 --- a/sdk/eventhub/azure-eventhubs/README.md +++ b/sdk/eventhub/azure-eventhubs/README.md @@ -13,7 +13,7 @@ The Azure Event Hubs client library allows for publishing and consuming of Azure - Observe interesting operations and interactions happening within your business or other ecosystem, allowing loosely coupled systems to interact without the need to bind them together. - Receive events from one or more publishers, transform them to better meet the needs of your ecosystem, then publish the transformed events to a new stream for consumers to observe. -[Source code](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhubs) | [Package (PyPi)](https://pypi.org/project/azure-eventhub/5.0.0b3) | [API reference documentation](https://azure.github.io/azure-sdk-for-python/ref/azure.eventhub) | [Product documentation](https://docs.microsoft.com/en-us/azure/event-hubs/) +[Source code](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhubs) | [Package (PyPi)](https://pypi.org/project/azure-eventhub/5.0.0b4) | [API reference documentation](https://azure.github.io/azure-sdk-for-python/ref/azure.eventhub) | [Product documentation](https://docs.microsoft.com/en-us/azure/event-hubs/) ## Getting started @@ -119,6 +119,7 @@ The following sections provide several code snippets covering some of the most c - [Async publish events to an Event Hub](#async-publish-events-to-an-event-hub) - [Async consume events from an Event Hub](#async-consume-events-from-an-event-hub) - [Consume events using an Event Processor](#consume-events-using-an-event-processor) +- [Use EventHubClient to work with IoT Hub](#use-eventhubclient-to-work-with-iot-hub) ### Inspect an Event Hub @@ -359,6 +360,24 @@ if __name__ == '__main__': loop.run_until_complete(main()) ``` +### Use EventHubClient to work with IoT Hub + +You can use `EventHubClient` to work with IoT Hub as well. This is useful for receiving telemetry data of IoT Hub from the +linked EventHub. The associated connection string will not have send claims, hence sending events is not possible. + +- Please notice that the connection string needs to be for an + [Event Hub-compatible endpoint](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-read-builtin) + e.g. "Endpoint=sb://my-iothub-namespace-[uid].servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;EntityPath=my-iot-hub-name" + +```python +from azure.eventhub import EventHubClient + +connection_str = 'Endpoint=sb://my-iothub-namespace-[uid].servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;EntityPath=my-iot-hub-name' +client = EventHubClient.from_connection_string(connection_str) + +partition_ids = client.get_partition_ids() +``` + ## Troubleshooting ### General diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/client_async.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/client_async.py index 06d117c10cd6..e679afaa1cf1 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/client_async.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/client_async.py @@ -223,7 +223,6 @@ def create_consumer( :type owner_level: int :param prefetch: The message prefetch count of the consumer. Default is 300. :type prefetch: int - :type track_last_enqueued_event_properties: bool :param track_last_enqueued_event_properties: Indicates whether or not the consumer should request information on the last enqueued event on its associated partition, and track that information as events are received. When information about the partition's last enqueued event is being tracked, each event received from the @@ -231,6 +230,7 @@ def create_consumer( network bandwidth consumption that is generally a favorable trade-off when considered against periodically making requests for partition properties using the Event Hub client. It is set to `False` by default. + :type track_last_enqueued_event_properties: bool :param loop: An event loop. If not specified the default event loop will be used. :rtype: ~azure.eventhub.aio.consumer_async.EventHubConsumer diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/consumer_async.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/consumer_async.py index 861e88383ed6..7aff6980b9e0 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/consumer_async.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/aio/consumer_async.py @@ -58,7 +58,6 @@ def __init__( # pylint: disable=super-init-not-called :param owner_level: The priority of the exclusive consumer. An exclusive consumer will be created if owner_level is set. :type owner_level: int - :type track_last_enqueued_event_properties: bool :param track_last_enqueued_event_properties: Indicates whether or not the consumer should request information on the last enqueued event on its associated partition, and track that information as events are received. When information about the partition's last enqueued event is being tracked, each event received from the @@ -66,6 +65,7 @@ def __init__( # pylint: disable=super-init-not-called network bandwidth consumption that is generally a favorable trade-off when considered against periodically making requests for partition properties using the Event Hub client. It is set to `False` by default. + :type track_last_enqueued_event_properties: bool :param loop: An event loop. """ event_position = kwargs.get("event_position", None) diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/client.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/client.py index df7390511f6c..9a7ca85e3330 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/client.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/client.py @@ -229,7 +229,6 @@ def create_consumer(self, consumer_group, partition_id, event_position, **kwargs :type owner_level: int :param prefetch: The message prefetch count of the consumer. Default is 300. :type prefetch: int - :type track_last_enqueued_event_properties: bool :param track_last_enqueued_event_properties: Indicates whether or not the consumer should request information on the last enqueued event on its associated partition, and track that information as events are received. When information about the partition's last enqueued event is being tracked, each event received from the @@ -237,6 +236,7 @@ def create_consumer(self, consumer_group, partition_id, event_position, **kwargs network bandwidth consumption that is generally a favorable trade-off when considered against periodically making requests for partition properties using the Event Hub client. It is set to `False` by default. + :type track_last_enqueued_event_properties: bool :rtype: ~azure.eventhub.consumer.EventHubConsumer Example: diff --git a/sdk/eventhub/azure-eventhubs/azure/eventhub/consumer.py b/sdk/eventhub/azure-eventhubs/azure/eventhub/consumer.py index dd94291a6b49..87869aaa3a7b 100644 --- a/sdk/eventhub/azure-eventhubs/azure/eventhub/consumer.py +++ b/sdk/eventhub/azure-eventhubs/azure/eventhub/consumer.py @@ -57,7 +57,6 @@ def __init__(self, client, source, **kwargs): :param owner_level: The priority of the exclusive consumer. An exclusive consumer will be created if owner_level is set. :type owner_level: int - :type track_last_enqueued_event_properties: bool :param track_last_enqueued_event_properties: Indicates whether or not the consumer should request information on the last enqueued event on its associated partition, and track that information as events are received. When information about the partition's last enqueued event is being tracked, each event received from the @@ -65,6 +64,7 @@ def __init__(self, client, source, **kwargs): network bandwidth consumption that is generally a favorable trade-off when considered against periodically making requests for partition properties using the Event Hub client. It is set to `False` by default. + :type track_last_enqueued_event_properties: bool """ event_position = kwargs.get("event_position", None) prefetch = kwargs.get("prefetch", 300)