Skip to content

Commit a6e0a61

Browse files
authored
renamed checkpoint by batch samples to by event count (Azure#15977)
* renamed checkpoint by batch samples to by event count * change link in EH sample readme for event count sample
1 parent 1e453ab commit a6e0a61

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

sdk/eventhub/azure-eventhub/samples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Both [sync version](https://github.com/Azure/azure-sdk-for-python/tree/master/sd
4040
- [recv_with_checkpoint_store.py](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub/samples/sync_samples/recv_with_checkpoint_store.py) ([async version](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub/samples/async_samples/recv_with_checkpoint_store_async.py)) - Examples to receive events and do checkpoint using blob checkpoint store:
4141
- Receive events and do checkpoint using blob checkpoint store
4242

43-
- [recv_with_checkpoint_by_batch.py](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub/samples/sync_samples/recv_with_checkpoint_by_batch.py) ([async version](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub/samples/async_samples/recv_with_checkpoint_by_batch_async.py)) - Examples to receive events and do checkpoint by batch using blob checkpoint store:
43+
- [recv_with_checkpoint_by_event_count.py](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub/samples/sync_samples/recv_with_checkpoint_by_event_count.py) ([async version](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub/samples/async_samples/recv_with_checkpoint_by_event_count_async.py)) - Examples to receive events and do checkpoint by event count using blob checkpoint store:
4444
- Receive events and do checkpoint every fixed amount of events (e.g. checkpoint every 20 events) using blob checkpoint store
4545

4646
- [receive_batch_with_checkpoint.py](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub/samples/sync_samples/receive_batch_with_checkpoint.py) ([async_version](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub/samples/async_samples/receive_batch_with_checkpoint_async.py)) - Examples to receive events in batches and do checkpoint by the batch:

sdk/eventhub/azure-eventhub/samples/async_samples/recv_with_checkpoint_by_batch_async.py renamed to sdk/eventhub/azure-eventhub/samples/async_samples/recv_with_checkpoint_by_event_count_async.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# --------------------------------------------------------------------------------------------
77

88
"""
9-
An example to show receiving events from an Event Hub with checkpoint store doing checkpoint by batch asynchronously.
9+
An example to show receiving events from an Event Hub with checkpoint store doing checkpoint
10+
by every fixed event count asynchronously.
1011
In the `receive` method of `EventHubConsumerClient`:
1112
If no partition id is specified, the checkpoint_store are used for load-balance and checkpoint.
1213
If partition id is specified, the checkpoint_store can only be used for checkpoint.
@@ -23,15 +24,15 @@
2324
BLOB_CONTAINER_NAME = "your-blob-container-name" # Please make sure the blob container resource exists.
2425

2526
partition_recv_cnt_since_last_checkpoint = defaultdict(int)
26-
checkpoint_batch_event_cnt = 20
27+
checkpoint_event_cnt = 20
2728

2829

2930
async def on_event(partition_context, event):
3031
# Put your code here.
3132
p_id = partition_context.partition_id
3233
print("Received event from partition: {}.".format(p_id))
3334
partition_recv_cnt_since_last_checkpoint[p_id] += 1
34-
if partition_recv_cnt_since_last_checkpoint[p_id] >= checkpoint_batch_event_cnt:
35+
if partition_recv_cnt_since_last_checkpoint[p_id] >= checkpoint_event_cnt:
3536
await partition_context.update_checkpoint(event)
3637
partition_recv_cnt_since_last_checkpoint[p_id] = 0
3738

sdk/eventhub/azure-eventhub/samples/sync_samples/recv_with_checkpoint_by_batch.py renamed to sdk/eventhub/azure-eventhub/samples/sync_samples/recv_with_checkpoint_by_event_count.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# --------------------------------------------------------------------------------------------
77

88
"""
9-
An example to show receiving events from an Event Hub with checkpoint store doing checkpoint by batch.
9+
An example to show receiving events from an Event Hub with checkpoint store doing checkpoint
10+
by every fixed event count.
1011
In the `receive` method of `EventHubConsumerClient`:
1112
If no partition id is specified, the checkpoint_store are used for load-balance and checkpoint.
1213
If partition id is specified, the checkpoint_store can only be used for checkpoint.
@@ -22,7 +23,7 @@
2223
BLOB_CONTAINER_NAME = "your-blob-container-name" # Please make sure the blob container resource exists.
2324

2425
partition_recv_cnt_since_last_checkpoint = defaultdict(int)
25-
checkpoint_batch_event_cnt = 20
26+
checkpoint_event_cnt = 20
2627

2728

2829
def on_event(partition_context, event):
@@ -31,7 +32,7 @@ def on_event(partition_context, event):
3132
p_id = partition_context.partition_id
3233
print("Received event from partition: {}".format(p_id))
3334
partition_recv_cnt_since_last_checkpoint[p_id] += 1
34-
if partition_recv_cnt_since_last_checkpoint[p_id] >= checkpoint_batch_event_cnt:
35+
if partition_recv_cnt_since_last_checkpoint[p_id] >= checkpoint_event_cnt:
3536
partition_context.update_checkpoint(event)
3637
partition_recv_cnt_since_last_checkpoint[p_id] = 0
3738

0 commit comments

Comments
 (0)