Complete the code to set the minimum number of Kafka partitions to 3.
partitions = [1]The minimum number of partitions is set to 3 to allow auto-scaling.
Complete the code to increase partitions dynamically using the Kafka admin client.
admin_client.create_partitions(topic='my_topic', new_total_partitions=[1])
Increasing partitions to 6 allows more parallelism for scaling.
Fix the error in the code to correctly configure auto-scaling based on lag.
if consumer_lag > [1]: scale_up()
The lag threshold is set to 1000 messages to trigger scaling.
Fill both blanks to create a dictionary comprehension that maps each partition to its lag if lag is greater than 500.
partition_lag = {partition: [1] for partition, lag in lags.items() if lag [2] 500}This comprehension selects partitions with lag greater than 500 and maps them to their lag values.
Fill all three blanks to create a dictionary comprehension that maps each partition to its lag if lag is greater than 1000 and partition number is less than 10.
filtered_lags = { [1]: [2] for [3], lag in lags.items() if lag > 1000 and [3] < 10 }This comprehension filters partitions with lag over 1000 and partition number less than 10, mapping partition to lag.