For channels to work properly, Eventsourced processors must copy the processorId and sequenceNr
values from a received (and journaled) input event message to output event messages. This is usually
done by calling copy() on the received input event message and updating only those fields that are
relevant for the application such as event or ack, for example:
class Processor(channel: ActorRef) extends Actor {
def receive = {
case msg: Message => {
// ...
channel ! msg.copy(event = ..., ack = ...)
}
}
}
A less reliable alternative to channels is communication via sender references. Event messages that
are sent to processors during a replay always have a deadLetters sender reference which prevents
redundant delivery as well. The main difference is that the delivery guarantee changes from
at-least-once to at-most-once.
A channel keeps track of successfully delivered event org.eligosource.eventsourced.core.Messages. Channels are used by org.eligosource.eventsourced.core.Eventsourced actors to prevent redundant message delivery to destinations during event message replay.
For channels to work properly,
Eventsourced
processors must copy theprocessorId
andsequenceNr
values from a received (and journaled) input event message to output event messages. This is usually done by callingcopy()
on the received input event message and updating only those fields that are relevant for the application such asevent
orack
, for example:When using an org.eligosource.eventsourced.core.Emitter, this is done automatically.
A less reliable alternative to channels is communication via sender references. Event messages that are sent to processors during a replay always have a
deadLetters
sender reference which prevents redundant delivery as well. The main difference is that the delivery guarantee changes from at-least-once to at-most-once.org.eligosource.eventsourced.core.DefaultChannel org.eligosource.eventsourced.core.ReliableChannel org.eligosource.eventsourced.core.Message org.eligosource.eventsourced.core.Confirm org.eligosource.eventsourced.core.EventsourcingExtension