The consumer will be within the logical boundary that owns the definition/schema of the command. There is a required single consumer of a command. There can be many producers of a command. Some will say Queries are also messages, but I disagree in the context of asynchronous messaging.Ĭommands are about invoking behavior. Commands & EventsĪ lot of the trouble I see with using Kafka revolves around applying various patterns or semantics typical with queues or a message broker and trying to force it with Kafka. The event is not removed from the topic when it’s consumed. Since Kafka is a log, the messages are always present there. Lifetime of messages: Since Rabbitmq is a message queue, messages are done away with once consumed and the acknowledgement is sent.
Message keys are used while sending the messages to the topic. Just because a consumer processes an event from a topic does not mean that they cannot process it again or that another consumer can’t consume it. Partitions in Kafka enable message ordering. However, this also allows existing consumers to re-process existing messages by changing the offset. This allows consumers to process new events that are appended to the topic.
I’ll get to consumer groups and partitions shortly. Kafka maintains an offset per topic, per consumer group, and partition.