Does Kafka support request response messaging

前端 未结 4 1605
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-31 00:05

I am investigating Kafka 9 as a hobby project and completed a few \"Hello World\" type examples.

I have got to thinking about Real World Kafka applications based on

4条回答
  •  傲寒
    傲寒 (楼主)
    2020-12-31 00:58

    I never tried that, but in theory, if you before starting any produce, produce some messages keyed with numbers from 0 to number of partitions from answer topic and your producers are already consumers of that topic, so every producer would receive at least one of those messages. So you could store that key on each producer and publish it with the uuid... After the process on the consumer, it can publish the answer (on the answer topic) with the uuid and keyed with that same key sent with it, so it will be got by the same producer that sent it... Once all messages with the same key is published in the same partition...

提交回复
热议问题