Update event metadata

Is it possible to update event metadata after the fact? For example, imagine that I want to undo a particular discrete change; I could emit an undo event with the ID of the prior event(s), the result of which would be an update to the metadata of the prior events marking them as undone; replaying the stream with metadata would then identify that these events can safely be ignored, without removing any event history.

No, not possible. Undo events are a very powerful workaround.

why do you consider modelling that as Metadata ?
Undo / compensating event types are very powerful indeed .
if the domain is heavily process based there are more often than not pre-existing compensation processes
, business users will recognize events & compensation processes , not metadata.

I can give you an example from one of the domains I’m working in, which is flexible employment. A company posts a job and the system finds matching and available workers and generates a job request for each of them, which they are then free to accept or reject. We capture the job requested event. Once the job has been filled, there are many outstanding job requests which are obsolete, whether the worker has responded or not. The system may generate hundreds of these requests for a single job, depending on how many workers the company needs, and a worker may get dozens of these requests if there is high demand for their skills in their area and many jobs get posted.

After the fact, the obsolete requests are not useful in calculating things like worker availability, etc., so it would be nice to be able to mark them as such so that a processor can choose to skip them when replaying the stream (some processors for analytics might choose to process obsolete events anyway).

You can model each job request as its own stream. It has a definite end state; it was either fulfilled or it wasn’t. Record this fact as well, and have a policy in place where after this fact, job requests are archived and purged within a certain amount of time.

1 Like