Skip to content

Aggregates 1.0.1

Choose a tag to compare

@FleaFX FleaFX released this 16 Nov 08:33
· 1 commit to main since this release
e5588af

Aggregates 1.0.1 restores two behaviours of 0.x that 1.0.0 had changed, makes the import dry-run report one more difference, and completes the migration guide. The public API is unchanged; from this release on, every package is validated against 1.0.0.

Behaviour changes

  • Command metadata is collected once per command. 1.0.0 evaluated the MetadataAttributes of a command after every event it produced, so an attribute that queries a database ran once per event. They now run once, after the last event, as in 0.x, also when the command produces no events. The attributes of the state still run after each event; for the same key with MetadataMultiplicity.Single, the command's value wins, as before.
  • A nested MetadataScope starts with the entries of the scope around it. In 1.0.0, new MetadataScope() started empty, so a scope opened inside another one (for example by two middlewares in one request) hid the outer entries from the commands. It now starts with a copy of the entries of MetadataScope.Current, as in 0.x; what it adds doesn't reach the outer scope. new MetadataScope(seed) still starts with the seed only, so the scopes of sagas, policies, deferred commands and replays of parked messages never pick up the metadata of the host around them. To keep the 1.0.0 behaviour for a scope of your own, open it with new MetadataScope(EventMetadata.Empty).

Migration from 0.x

  • The import dry-run (PersistentSubscriptionMigration.PlanAsync) now reports a handler of object whose 0.x group had an event-type filter as a difference: EventTypes is all (0.x: n), a warning, where it was all.
  • Migrating from 0.x describes three more differences:
    • Event-type filter. 0.x left out of a group's filter the event types its handler threw on in a trial when the group was created; 1.0 delivers every type assignable to the handler's event type. A handler that relied on throwing gets a marker interface on the types its 0.x group read.
    • Metadata values. 0.x read every metadata value as a JsonElement. The guide shows how to keep those values, when to choose them, and what to expect from keys with MetadataMultiplicity.Multiple and from keys passed on by sagas and policies.
    • Policies dispatch per yield. 0.x collected a policy's reaction before dispatching it; 1.0 dispatches each command as it is yielded, and a retry runs the reaction again. The guide shows how to collect the commands first where that matters.