Skip to content

Event reference

Herald records two kinds of events in the event store of the application that hosts it.

Cratis.Showrunner.Herald.Contracts holds the facts a host reacts to and projects. They are recorded against whatever the email was about and carry the EmailId the application got from Send. None carries the recipient, a value of the email or a credential.

EventRecorded whenProperties
EmailSentThe mail server accepted the email.EmailId, Kind, Language, Attempts
EmailFailedThe email will not be sent: it could not be rendered, the server refused it for good, or the attempts ran out.EmailId, Kind, Language, Reason, Attempts
EmailBouncedThe application reported that an accepted email did not arrive.EmailId, Kind, Reason

These events are not [Public]. Public events are accepted only by the outbox and refused by the event log, and Herald records in the event log so that the application’s own projections and reactors can follow them, for example to mark an invitation as sent. Read them in a projection:

[FromEvent<EmailSent>]
public record InvitationDelivery(
[property: Key] EventSourceId InvitationId,
DateTimeOffset? SentAt);

Cratis.Showrunner.Herald has two more events that carry the delivery:

EventRecorded when
EmailQueuedSend accepted the email. Holds the kind, the language asked for, the recipient and the values. The recipient and the values are personal data.
EmailAttemptFailedA delivery failed and Herald will try again. Holds the attempt number, the reason and when the next attempt is due.

The contracts package has a snapshot of every event’s schema, and a specification that fails when the schema of a released generation changes. A change to a released event is a new generation of the event, with a migration, never an edit.