3333 get_system_config ,
3434 validate_cli_args ,
3535 log_event_received ,
36- get_topic_partitions ,
3736 set_producer_consumer ,
38- get_custom_partitioner ,
3937 import_state_store_class ,
4038)
4139
6159TOPIC_PIZZA_ORDERED = SYS_CONFIG ["kafka-topics" ]["pizza_ordered" ]
6260TOPIC_PIZZA_BAKED = SYS_CONFIG ["kafka-topics" ]["pizza_baked" ]
6361CONSUME_TOPICS = [TOPIC_PIZZA_ORDERED , TOPIC_PIZZA_BAKED ]
64- _ , PRODUCER , CONSUMER , ADMIN_CLIENT = set_producer_consumer (
62+ _ , PRODUCER , CONSUMER , _ = set_producer_consumer (
6563 kafka_config_file ,
6664 producer_extra_config = {
6765 "on_delivery" : delivery_report ,
7270 "client.id" : f"""{ SYS_CONFIG ["kafka-client-id" ]["microservice_delivery" ]} _{ HOSTNAME } """ ,
7371 },
7472)
75- CUSTOM_PARTITIONER = get_custom_partitioner ()
76- PARTITIONS_DELIVERED = get_topic_partitions (ADMIN_CLIENT , PRODUCE_TOPIC_DELIVERED )
77- PARTITIONS_PENDING = get_topic_partitions (ADMIN_CLIENT , PRODUCE_TOPIC_PENDING )
78- PARTITIONS_STATUS = get_topic_partitions (ADMIN_CLIENT , PRODUCE_TOPIC_STATUS )
7973
8074# Set signal handler
8175GRACEFUL_SHUTDOWN = GracefulShutdown (consumer = CONSUMER )
@@ -110,7 +104,6 @@ def pizza_delivered(order_id: str):
110104 "timestamp" : timestamp_now (),
111105 }
112106 ).encode (),
113- partition = CUSTOM_PARTITIONER (order_id .encode (), PARTITIONS_DELIVERED ),
114107 )
115108 PRODUCER .flush ()
116109
@@ -125,7 +118,6 @@ def pizza_pending(order_id: str):
125118 "timestamp" : timestamp_now (),
126119 }
127120 ).encode (),
128- partition = CUSTOM_PARTITIONER (order_id .encode (), PARTITIONS_PENDING ),
129121 )
130122 PRODUCER .flush ()
131123
0 commit comments