Processing within one partition
Similar to the previous example, where we learned how to process across partitions, we can use the EventHubConsumerClient
class to process data within single partitions, too. All we have to do is specify the partition ID in the client.receive
call, as demonstrated in the following code snippet. The rest of the code will remain the same as the previous example:
With client: client.receive( on_event=on_event, partition_id='0', # To read only partition 0 )
This is how we can programmatically process the data from specific Event Hubs partitions.
Next, let's look at how to scale resources for stream processing.