TopicRouter

class TopicRouter(val types: Set<AggregateType>, val topic: String, partitions: Int, producer: TopicProducer)

The topic router of one context: the commands of its types are admitted by writing them to the context's command topic, whose partitions are the context's log partitions (partitions), each in the one the log's Partitioner gives its aggregate, so the owner of the aggregate's log partition reads and executes it (me.ahoo.wow.runtime.command.CommandIntake) with no forwarding, and one aggregate's commands keep their order.

send returns once the broker acknowledged the command: it is then durable, ACCEPTED means it will not be lost, and the node that admitted it may stop at once. It throws when the broker did not acknowledge it; the command may still have been written, and a retry with the same request id is not decided twice.

Constructors

Link copied to clipboard
constructor(types: Set<AggregateType>, topic: String, partitions: Int, producer: TopicProducer)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Whether the commands of type go through the command topic.

Link copied to clipboard
suspend fun send(model: AggregateModel<*>, command: Command<*>, wait: WaitContext?)

Writes command, of model's aggregate, to the command topic with wait and the trace it is sent in, and waits for the broker.