Skip to content

Commit 5ad3409

Browse files
authored
Merge pull request #241996 from spelluru/ehubretention0619
configure properties for an event hub
2 parents 84be360 + 2fe3219 commit 5ad3409

File tree

4 files changed

+77
-1
lines changed

4 files changed

+77
-1
lines changed

articles/event-hubs/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@
297297
href: apache-kafka-frequently-asked-questions.yml
298298
- name: Manage and monitor
299299
items:
300+
- name: Configure properties for an event hub
301+
href: configure-event-hub-properties.md
300302
- name: Monitor Azure Event Hubs
301303
href: monitor-event-hubs.md
302304
- name: Stream Azure Diagnostics data using Event Hubs
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: Configure properties for an Azure event hub
3+
description: Learn how to configure status, partition count, cleanup policy, and retention time for an event hub
4+
ms.topic: how-to
5+
ms.custom: log-compaction
6+
ms.date: 06/19/2023
7+
---
8+
9+
# Configure properties for an event hub
10+
This article shows you how to configure properties such as status, partition count, retention time, etc. for an event hub.
11+
12+
## Configure status
13+
You can update the status of an event hub to one of these values on the **Properties** page after the event hub is created.
14+
15+
- Select **Active** (default) if you want to send events to and receive events from an event hub.
16+
- Select **Disabled** if you want to disable both sending and receiving events from an event hub.
17+
- Select **SendDisabled** if you want to disable sending events to an event hub.
18+
19+
:::image type="content" source="./media/configure-event-hub-properties/properties-page.png" alt-text="Screenshot showing the Properties page for an event hub.":::
20+
21+
22+
23+
## Configure partition count
24+
The **Properties** page allows you to see the number of partitions in an event hub for event hubs in all tiers. It allows you to update the partition count for event hubs in a premium or dedicated tier. For other tiers, you can only specify the partition count at the time of creating an event hub. To learn about partitions in Event Hubs, see [Scalability](event-hubs-scalability.md#partitions)
25+
26+
### Configure cleanup policy
27+
You see the cleanup policy for an event hub on the **Properties** page. You can't update it. By default, an event hub is created with the **delete** cleanup policy, where events are purged upon the expiration of the retention time. While creating an event hub, you can set the cleanup policy to **Compact**. For more information, see [Log compaction](log-compaction.md) and [Configure log compaction](use-log-compaction.md).
28+
29+
30+
## Configure retention time
31+
32+
If the cleanup policy is set to **Delete**, the **retention time** is the maximum time that Event Hubs retains an event before discarding the event. The **Properties** page allows you to specify retention time in hours.
33+
34+
If the cleanup policy is set to **Compact** at the time of creating an event hub, the **infinite retention time** is automatically enabled. You can set the **Tombstone retention time in hours** though. Client applications can mark existing events of an event hub to be deleted during a compaction job by sending a new event with an existing key and a `null` event payload. These markers are known as **Tombstones**. The **Tombstone retention time in hours** is the time to retain tombstone markers in a compacted event hub.
35+
36+
## Azure CLI
37+
Use the [`az eventhubs eventhub update`](/cli/azure/eventhubs/eventhub#az-eventhubs-eventhub-update) command to configure partition count and retention settings for an event hub.
38+
39+
- Use the `--status` parameter to set the status of an existing event hub to `Active`, `Disabled`, or `SendDisabled` or `ReceiveDisabled`.
40+
- Use `--partition-count` parameter to specify the number of partitions. You can specify the partition count for an existing event hub only if it's in the premium or dedicated tier namespace.
41+
- Use the `--retention-time` to specify the number of hours to retain events for an event hub, if the `cleanupPolicy` is `Delete`.
42+
- Use the `--tombstone-retention-time-in-hours` to specify the number of hours to retain the tombstone markers, if the `cleanupPolicy` is `Compact`.
43+
44+
45+
## Azure PowerShell
46+
Use the [`Set-AzEventHub`](/powershell/module/az.eventhub/set-azeventhub) by using the `-Status`, `-RetentionTimeInHour` or `TomstoneRetentionTimeInHour` parameters. Currently, the PowerShell command doesn't support updating the partition count for an event hub.
47+
48+
## Azure Resource Manager template
49+
50+
If you're using an Azure Resource Manager template, use the `partitionCount` and `retentionTimeinHours` as shown in the following example. `MYNAMESPACE` is the name of the Event Hubs namespace and `MYEVENTHUB` is the name of the event hub in this example.
51+
52+
```json
53+
{
54+
"type": "Microsoft.EventHub/namespaces/eventhubs",
55+
"apiVersion": "2022-10-01-preview",
56+
"name": "MYNAMESPACE/MYEVENTHUB ",
57+
"properties": {
58+
"partitionIds": [],
59+
"partitionCount": 1,
60+
"captureDescription": null,
61+
"retentionDescription": {
62+
"cleanupPolicy": "Delete",
63+
"retentionTimeInHours": 1
64+
}
65+
}
66+
}
67+
```
68+
69+
## Next steps
70+
See the following articles:
71+
72+
- [Scalability](event-hubs-scalability.md#partitions)
73+
- [Log compaction](log-compaction.md) and [Configure log compaction](use-log-compaction.md)-

articles/event-hubs/event-hubs-features.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ architectural philosophy here's that historic data needs richer indexing and
7373
more direct access than the real-time eventing interface that Event Hubs or
7474
Kafka provide. Event stream engines aren't well suited to play the role of data
7575
lakes or long-term archives for event sourcing.
76-
76+
77+
7778

7879
> [!NOTE]
7980
> Event Hubs is a real-time event stream engine and is not designed to be used instead of a database and/or as a
43.3 KB
Loading

0 commit comments

Comments
 (0)