Package

net.artsy

atomic

Permalink

package atomic

Visibility
  1. Public
  2. All

Type Members

  1. abstract class AtomicEventStore[EventType <: Serializable, ValidationReason] extends Serializable

    Permalink

    Implements a data-agnostic persistent event store, in the Event Sourcing methodology.

    Implements a data-agnostic persistent event store, in the Event Sourcing methodology. The store is divided into scopes, and within each scope events can be admitted to a log, one at a time. Clients request events to be admitted to the log by sending StoreIfValid messages containing the prospective EventType.

    The sender of the event will receive a ValidationRequest message, and is then responsible for validating the event, or delegating that responsibility. The validator determines whether a command should be accepted as an event, considering all of the previously accepted events as context for that decision, and replies to the log with a ValidationResponse message. The log will then persist the event to storage, if it was accepted, and then reply to the client with a Result message. The client is then responsible for carrying out the consequences of the event being accepted or rejected, e.g. updating state and notifying its downstream clients. During validation, the AtomicEventStore postpones consideration of any other events, maintaining atomicity.

    It's important for the client to *not* attempt to perform any "prevalidation" on an event in the context of other events, before sending the event to the AtomicEventStore. This would break atomicity. Always do all validation only in response to the ValidationRequest message.

    Subclass this abstract class, and then use AtomicEventStore#receptionistProps as the entry point for instantiating the system. The receptionist manages the lifecycle of the logs, and the logs manage their own persistence.

    EventType

    the supertype of domain events used by this store

    ValidationReason

    supertype for descriptor objects that indicate why an event validation failed (or succeeded).

  2. trait Scoped[T] extends Serializable

    Permalink

    Typeclass for objects that provide a string scope identifier that can be used to categorize them.

    Typeclass for objects that provide a string scope identifier that can be used to categorize them. In the context of AtomicEventStore, the scope identifier indicates the atomic log to which the event should be submitted, and atomicity is maintained per scope identifier, meaning that events for differing scopes can be processed in parallel, but within a scope, they are strictly sequential.

    This is external to the DomainEvent supertype client code uses so that the classes used in the client code need not natively know anything about scopes.

    T

    the underlying type

Ungrouped