This feature was needed for allowing daemons to separate some tasks from the run routine.
For example, KafkaListener might need to handle arbitrary types of messages according to the run_start_message.
With this change, KafkaListener can now register handlers whenever it receives run_start_message and don't have to handle them in the run routine.
It can simply wrap received messages as a certain types of MessageProtocol and yield them,
instead of wrap them and handle them within the routine.
This feature was needed for allowing daemons to separate some tasks from the
run
routine.For example,
KafkaListener
might need to handle arbitrary types of messages according to therun_start_message
. With this change,KafkaListener
can now register handlers whenever it receivesrun_start_message
and don't have to handle them in therun
routine. It can simply wrap received messages as a certain types ofMessageProtocol
and yield them, instead of wrap them and handle them within the routine.