Package

com.rbmhtechnology

eventuate

Permalink

package eventuate

Visibility
  1. Public
  2. All

Type Members

  1. abstract class AbstractEventsourcedActor extends AbstractEventsourcedView with EventsourcedActor with ConfirmedDelivery with PersistOnEvent

    Permalink

    Java API for actors that implement EventsourcedActor.

    Java API for actors that implement EventsourcedActor.

    See also

    EventsourcedActor

    AbstractEventsourcedView for a detailed usage of the Java API

  2. class AbstractEventsourcedProcessor extends AbstractEventsourcedComponent with EventsourcedProcessor with EventSourcedProcessorAdapter with EventsourcedProcessorWriteSuccessHandlerAdapter

    Permalink

    Java API for actors that implement EventsourcedProcessor.

    Java API for actors that implement EventsourcedProcessor.

    See also

    EventsourcedProcessor

    AbstractEventsourcedView for a detailed usage of the Java API

  3. class AbstractEventsourcedStatefulProcessor extends AbstractEventsourcedComponent with StatefulProcessor with EventSourcedProcessorAdapter with EventsourcedProcessorWriteSuccessHandlerAdapter

    Permalink

    Java API for actors that implement StatefulProcessor.

    Java API for actors that implement StatefulProcessor.

    See also

    StatefulProcessor

    AbstractEventsourcedView for a detailed usage of the Java API

  4. abstract class AbstractEventsourcedView extends AbstractEventsourcedComponent

    Permalink

    Java API for actors that implement EventsourcedView.

    Java API for actors that implement EventsourcedView.

    Actor handlers may be initialized once in the constructor with various set-methods (e.g. setOnCommand, setOnEvent) or by overriding the respective handler (e.g. onCommand(...), onEvent(...)). If a handler is overridden, the behaviour of it's respective set-method will be ignored.

    Example:

    public class HelloActor extends AbstractEventsourcedView {
       public HelloActor(final String id, final ActorRef eventLog) {
         super(id, eventLog);
    
         onCommand(ReceiveBuilder
           .match(String.class, str -> str.equals("Hello"), value -> sender().tell("World", self())
           .matchAny(ev -> value -> sender().tell("Please try again", self())
           .build());
       }
    
       public PartialFunction<Object, BoxedUnit> onEvent() {
         return ReceiveBuilder
           .matchAny(HelloEvent.class, ev -> handleEvent(ev))
           .build();
       }
    }
    See also

    EventsourcedView

  5. abstract class AbstractEventsourcedWriter[R, W] extends AbstractEventsourcedView with EventsourcedWriter[R, W] with EventsourcedWriterFailureHandlerAdapter with EventsourcedWriterSuccessHandlerAdapter[R, W]

    Permalink

    Java API for actors that implement EventsourcedWriter.

    Java API for actors that implement EventsourcedWriter.

    See also

    EventsourcedWriter

    AbstractEventsourcedView for a detailed usage of the Java API

  6. case class ApplicationVersion(major: Int = 1, minor: Int = 0) extends Product with Serializable

    Permalink

    Defines an application version in terms of major version and minor version.

  7. trait BehaviorContext extends AnyRef

    Permalink

    Provides a context for managing behaviors.

  8. case class BinaryPayloadManifestFilter(regex: Regex) extends ReplicationFilter with Product with Serializable

    Permalink

    A ReplicationFilter that can be used in combination with com.rbmhtechnology.eventuate.serializer.DurableEventSerializerWithBinaryPayload.

    A ReplicationFilter that can be used in combination with com.rbmhtechnology.eventuate.serializer.DurableEventSerializerWithBinaryPayload.

    It evaluates to true if the payload's manifest matches regex.

  9. trait ConcurrentVersions[A, B] extends Serializable

    Permalink

    Tracks concurrent Versioned values which arise from concurrent updates.

    Tracks concurrent Versioned values which arise from concurrent updates.

    A

    Versioned value type

    B

    Update type

  10. class ConcurrentVersionsList[A] extends ConcurrentVersions[A, A]

    Permalink

    A ConcurrentVersions implementation that shall be used if updates replace current versioned values (= full updates).

    A ConcurrentVersions implementation that shall be used if updates replace current versioned values (= full updates). ConcurrentVersionsList is an immutable data structure.

  11. class ConcurrentVersionsTree[A, B] extends ConcurrentVersions[A, B]

    Permalink

    A ConcurrentVersions implementation that shall be used if updates are incremental.

    A ConcurrentVersions implementation that shall be used if updates are incremental. ConcurrentVersionsTree is a mutable data structure. Therefore, it is recommended not to share instances of ConcurrentVersionsTree directly but rather the Versioned sequence returned by ConcurrentVersionsTree#all. Later releases will be based on an immutable data structure.

    Please note: This implementation does not purge old versions at the moment (which shouldn't be a problem if the number of incremental updates to a versioned aggregate is rather small). In later releases, manual and automated purging of old versions will be supported.

  12. case class ConditionalRequest(condition: VectorTime, req: Any) extends Product with Serializable

    Permalink

    A conditional request is a request to an actor in the EventsourcedView hierarchy whose delivery to the actor's command handler is delayed until the request's condition is in the causal past of that actor (i.e.

    A conditional request is a request to an actor in the EventsourcedView hierarchy whose delivery to the actor's command handler is delayed until the request's condition is in the causal past of that actor (i.e. if the condition is <= the actor's current version).

  13. class ConditionalRequestException extends RuntimeException

    Permalink

    Thrown by an actor in the EventsourcedView hierarchy if it receives a ConditionalRequest but does not extends the ConditionalRequests trait.

  14. trait ConditionalRequests extends EventsourcedView with EventsourcedVersion

    Permalink

    Must be extended by actors in the EventsourcedView hierarchy if they want to support ConditionalRequest processing.

  15. trait ConfirmedDelivery extends EventsourcedActor

    Permalink

    Supports the reliable delivery of messages to destinations by enabling applications to redeliver messages until they are confirmed by their destinations.

    Supports the reliable delivery of messages to destinations by enabling applications to redeliver messages until they are confirmed by their destinations. The correlation identifier between a reliable message and its confirmation message is an application-defined deliveryId. Reliable messages are delivered by calling deliver in an EventsourcedActor's event handler. When the destination replies with a confirmation message, the event-sourced actor must persist an application-defined confirmation event together with the deliveryId using the persistConfirmation method. Until successful persistence of the confirmation event, delivered messages are tracked as unconfirmed messages. Unconfirmed messages can be redelivered by calling redeliverUnconfirmed. This is usually done within a command handler by processing scheduler messages. Redelivery occurs automatically when the event-sourced actor successfully recovered after initial start or a re-start.

  16. case class DurableEvent(payload: Any, emitterId: String = DurableEvent.UndefinedEmittedId, emitterAggregateId: Option[String] = None, customDestinationAggregateIds: Set[String] = Set(), systemTimestamp: Long = 0L, vectorTimestamp: VectorTime = VectorTime.Zero, processId: String = DurableEvent.UndefinedLogId, localLogId: String = DurableEvent.UndefinedLogId, localSequenceNr: Long = DurableEvent.UndefinedSequenceNr, deliveryId: Option[String] = None, persistOnEventSequenceNr: Option[Long] = None, persistOnEventId: Option[EventId] = None) extends Product with Serializable

    Permalink

    Provider API.

    Provider API.

    Event storage format. Fields localLogId and localSequenceNr differ among replicas, all other fields are not changed during event replication.

    payload

    Application-defined event.

    emitterId

    Id of emitter (EventsourcedActor or EventsourcedProcessor).

    emitterAggregateId

    Aggregate id of emitter (EventsourcedActor or EventsourcedProcessor). This is also the default routing destination of this event. If defined, the event is routed to event- sourced actors, views, writers and processors with a matching aggregateId. In any case, the event is routed to event-sourced actors, views, writers and processors with an undefined aggregateId.

    customDestinationAggregateIds

    Aggregate ids of additional, custom routing destinations. If non-empty, the event is additionally routed to event-sourced actors, views, writers and processors with a matching aggregateId.

    systemTimestamp

    Wall-clock timestamp, generated by the source of concurrent activity that is identified by processId.

    vectorTimestamp

    Vector timestamp, generated by the source of concurrent activity that is identified by processId.

    processId

    Id of the causality-tracking source of concurrent activity. This is the id of the local event log that initially wrote the event.

    localLogId

    Id of the local event log.

    localSequenceNr

    Sequence number in the local event log.

    deliveryId

    Delivery id chosen by an application that persisted this event with ConfirmedDelivery.persistConfirmation.

    persistOnEventSequenceNr

    Sequence number of the event that caused the emission of this event in an event handler. Defined if an EventsourcedActor with a PersistOnEvent mixin emitted this event with persistOnEvent. Actually superseded by persistOnEventId, but still has to be maintained for backwards compatibility. It is required for confirmation of old com.rbmhtechnology.eventuate.PersistOnEvent.PersistOnEventRequests from a snapshot that do not have com.rbmhtechnology.eventuate.PersistOnEvent.PersistOnEventRequest.persistOnEventId set.

    persistOnEventId

    event id of the event that caused the emission of this event in an event handler. Defined if an EventsourcedActor with a PersistOnEvent mixin emitted this event with persistOnEvent.

  17. trait DurableEventBatch extends AnyRef

    Permalink

    Implemented by protocol messages that contain a DurableEvent sequence.

  18. trait EndpointFilters extends AnyRef

    Permalink

    EndpointFilters computes a ReplicationFilter that shall be applied to a replication read request that replicates from a source log (defined by sourceLogName) to a target log (defined by targetLogId).

  19. case class EventId(processId: String, sequenceNr: Long) extends Product with Serializable

    Permalink

    Unique id of a DurableEvent.

    Unique id of a DurableEvent.

    This is a stable id of an event across all replicated logs.

    processId

    the id of the event log the initially wrote the event.

    sequenceNr

    the initial sequence number in this log.

  20. trait EventsourcedActor extends EventsourcedView with EventsourcedVersion

    Permalink

    An EventsourcedActor is an EventsourcedView that can also write new events to its event log.

    An EventsourcedActor is an EventsourcedView that can also write new events to its event log. New events are written with the asynchronous persist and persistN methods. They must only be used within the onCommand command handler. After successful persistence, the onEvent handler is automatically called with the persisted event(s). The onEvent handler is the place where actor state may be updated. The onCommand handler should not update actor state but only read it e.g. for command validation. EventsourcedActors that want to persist new events within the onEvent handler should additionally mixin the PersistOnEvent trait and use the persistOnEvent method.

    See also

    PersistOnEvent

    EventsourcedView

  21. trait EventsourcedProcessor extends EventsourcedWriter[Long, Long] with ActorLogging

    Permalink

    An EventsourcedWriter that writes processed events to a targetEventLog.

    An EventsourcedWriter that writes processed events to a targetEventLog. EventsourcedProcessor is an idempotent writer that guarantees that no duplicates are ever written to the target event log, also under failure conditions. Hence, applications don't need to take extra care about idempotency. Processed events are those returned by processEvent, an application-defined event handler that is invoked with events from the source eventLog.

    During initialization, a processor reads the processing progress from the target event log. The timeout for this read operation can be configured with the eventuate.log.read-timeout parameter for all event-sourced processors or defined on a per class or instance basis by overriding readTimeout. The timeout for write operations to the target log can be configured with the eventuate.log.write-timeout parameter for all event-sourced processors or defined on a per class or instance basis by overriding writeTimeout.

    An EventsourcedProcessor is a stateless processor i.e. in-memory state created from source events can not be recovered. An application that needs stateful event processing should use StatefulProcessor instead.

    An EventsourcedProcessor processor writes events with vector timestamps set to source event vector timestamp. In other words, it does not modify event vector timestamps.

    The source event log and the target event log of an EventsourcedProcessor must be different. Writing processed events back to the source event log has no effect.

    See also

    StatefulProcessor

  22. trait EventsourcedVersion extends EventsourcedView

    Permalink

    Maintains the current version of an event-sourced component.

    Maintains the current version of an event-sourced component. The current version is updated by merging DurableEvent.vectorTimestamps of handled events.

  23. trait EventsourcedView extends Actor with Stash

    Permalink

    An actor that derives internal state from events stored in an event log.

    An actor that derives internal state from events stored in an event log. Events are pushed from the eventLog actor to this actor and handled with the onEvent event handler. An event handler defines how internal state is updated from events.

    An EventsourcedView can also store snapshots of internal state with its save method. During (re-)start the latest snapshot saved by this actor (if any) is passed as argument to the onSnapshot handler, if the handler is defined at that snapshot. If the onSnapshot handler is not defined at that snapshot or is not overridden at all, event replay starts from scratch. Newer events that are not covered by the snapshot are handled by onEvent after onSnapshot returns.

    By default, an EventsourcedView does not define an aggregateId. In this case, the eventLog pushes all events to this actor. If it defines an aggregateId, the eventLog actor only pushes those events that contain that aggregateId value in their routingDestinations set.

    An EventsourcedView can only consume events from its eventLog but cannot produce new events. Commands sent to an EventsourcedView during recovery are delayed until recovery completes.

    Event replay is subject to backpressure. After a configurable number of events (see eventuate.log.replay-batch-size configuration parameter), replay is suspended until these events have been handled by onEvent and then resumed again. There's no backpressure mechanism for live event processing yet (but will come in future releases).

    See also

    EventsourcedProcessor

    EventsourcedWriter

    EventsourcedActor

    DurableEvent

  24. trait EventsourcedWriter[R, W] extends EventsourcedView with EventsourcedWriterSuccessHandlers[R, W] with EventsourcedWriterFailureHandlers

    Permalink

    An EventsourcedView designed to update external databases from events stored in its event log.

    An EventsourcedView designed to update external databases from events stored in its event log. It supports event processing patterns optimized for batch-updating external databases to create persistent views or read models:

    • During initialization, a concrete EventsourcedWriter asynchronously reads data from the external database to obtain information about the actual event processing progress. For example, if the last processed event sequence number is written with every batch update to the database, it can be read during initialization and used by the writer to detect duplicates during further event processing so that event processing can be made idempotent.
    • During event processing in its onEvent handler, a concrete writer usually builds a database-specific write-batch (representing an incremental update). After a configurable number of events, EventsourcedWriter calls write to asynchronously write the prepared batch to the database.

    An EventsourcedWriter may also implement an onCommand handler to process commands and save snapshots of internal state. Internal state is recovered by replaying events from the event log, optionally starting from a saved snapshot (see EventsourcedView for details). If a writer doesn't require full internal state recovery, it may define a custom starting position in the event log by returning a sequence number from readSuccess. If full internal state recovery is required instead, readSuccess should return None (which is the default).

    Implementation notes:

    • After having started an asynchronous write but before returning from write, a writer should clear the prepared write batch so that further events can be processed while the asynchronous write operation is in progress.
    • Event processing during replay (either starting from a default or application-defined position) is subject to backpressure. After a configurable number of events (see eventuate.log.replay-batch-size configuration parameter), replay is suspended until these events have been written to the target database and then resumed again. There's no backpressure mechanism for live event processing yet (but will come in future releases).
    R

    Result type of the asynchronous read operation.

    W

    Result type of the asynchronous write operations.

    See also

    StatefulProcessor

    EventsourcedProcessor

  25. trait PersistOnEvent extends EventsourcedActor

    Permalink

    Can be mixed into EventsourcedActor for writing new events within the onEvent handler.

    Can be mixed into EventsourcedActor for writing new events within the onEvent handler. New events are written with the asynchronous persistOnEvent method. In contrast to persist, one can not prevent command processing from running concurrently to persistOnEvent by setting stateSync to true.

    A persistOnEvent operation is reliable and idempotent. Once the event has been successfully written, a repeated persistOnEvent call for that event during event replay has no effect. A failed persistOnEvent operation will restart the actor by throwing a PersistOnEventException. After restart, failed persistOnEvent operations are automatically re-tried.

  26. class PersistOnEventException extends RuntimeException

    Permalink

    Thrown to indicate that an asynchronous persisOnEvent operation failed.

  27. final class ProcessBuilder extends AnyRef

    Permalink
  28. class RecoveryException extends RuntimeException

    Permalink

    ReplicationEndpoint.recover completes with this exception if recovery fails.

  29. case class ReplicationConnection(host: String, port: Int, name: String = ...) extends Product with Serializable

    Permalink

    A replication connection descriptor.

    A replication connection descriptor.

    host

    Host of the remote actor system that runs a ReplicationEndpoint.

    port

    Port of the remote actor system that runs a ReplicationEndpoint.

    name

    Name of the remote actor system that runs a ReplicationEndpoint.

  30. class ReplicationEndpoint extends AnyRef

    Permalink

    A replication endpoint connects to other replication endpoints for replicating events.

    A replication endpoint connects to other replication endpoints for replicating events. Events are replicated from the connected endpoints to this endpoint. The connected endpoints are replication sources, this endpoint is a replication target. To setup bi-directional replication, the other replication endpoints must additionally setup replication connections to this endpoint.

    A replication endpoint manages one or more event logs. Event logs are indexed by name. Events are replicated only between event logs with matching names.

    If applicationName equals that of a replication source, events are only replicated if applicationVersion is greater than or equal to that of the replication source. This is a simple mechanism to support incremental version upgrades of replicated applications where each replica can be upgraded individually without shutting down other replicas. This avoids permanent state divergence during upgrade which may occur if events are replicated from replicas with higher version to those with lower version. If applicationName does not equal that of a replication source, events are always replicated, regardless of the applicationVersion value.

  31. trait ReplicationFilter extends Serializable

    Permalink

    Serializable and composable replication filter.

  32. class ReplicationSettings extends AnyRef

    Permalink
  33. class ResultHandler[A] extends AnyRef

    Permalink

    Java API handler that accepts a success and a failure function.

    Java API handler that accepts a success and a failure function. Used to asynchronously execute the appropriate function based on the result of an action or calculation.

    A

    type of the result object

  34. case class Snapshot(payload: Any, emitterId: String, lastEvent: DurableEvent, currentTime: VectorTime, sequenceNr: Long, deliveryAttempts: Vector[DeliveryAttempt] = Vector.empty, persistOnEventRequests: Vector[PersistOnEventRequest] = Vector.empty) extends Product with Serializable

    Permalink

    Provider API.

    Provider API.

    Snapshot storage format. EventsourcedActors, EventsourcedViews, stateful EventsourcedWriters and EventsourcedProcessors can save snapshots of internal state by calling the (inherited) EventsourcedView#save method.

    payload

    Application-specific snapshot.

    emitterId

    Id of the event-sourced actor, view, stateful writer or processor that saved the snapshot.

    lastEvent

    Last handled event before the snapshot was saved.

    currentTime

    Current vector time when the snapshot was saved.

    sequenceNr

    Sequence number of the last *received* event when the snapshot was saved.

    deliveryAttempts

    Unconfirmed DeliveryAttempts when the snapshot was saved (can only be non-empty if the actor implements ConfirmedDelivery).

    persistOnEventRequests

    Unconfirmed PersistOnEventRequests when the snapshot was saved (can only be non-empty if the actor implements PersistOnEvent).

  35. case class SnapshotMetadata(emitterId: String, sequenceNr: Long) extends Product with Serializable

    Permalink

    Snapshot metadata.

    Snapshot metadata.

    emitterId

    Id of the EventsourcedActor, EventsourcedView, stateful EventsourcedWriter or EventsourcedProcessor that saves the snapshot.

    sequenceNr

    The highest event sequence number covered by the snapshot.

  36. class StashError extends Error

    Permalink

    Thrown to indicate that a stash() operation was used at an illegal location.

  37. trait StatefulProcessor extends EventsourcedProcessor with EventsourcedVersion

    Permalink

    An EventsourcedProcessor that supports stateful event processing.

    An EventsourcedProcessor that supports stateful event processing. In-memory state created from source events is recovered during event replay, either starting from scratch or from a previously saved snapshot.

    A StatefulProcessor writes events with vector timestamps set to the processor's current vector time. In other words, a written event has a potential causal relationship to all past source events.

    See also

    EventsourcedProcessor.

  38. trait UpdateableEventBatch[A <: UpdateableEventBatch[A]] extends DurableEventBatch

    Permalink

    Implemented by protocol messages whose event sequence can be updated.

  39. case class VectorTime(value: Map[String, Long] = Map.empty) extends Product with Serializable

    Permalink

    Vector time, represented as process id -> logical time map.

  40. case class Versioned[A](value: A, vectorTimestamp: VectorTime, systemTimestamp: Long = 0L, creator: String = "") extends Product with Serializable

    Permalink

    A versioned value.

    A versioned value.

    value

    The value.

    vectorTimestamp

    Update vector timestamp of the event that caused this version.

    systemTimestamp

    Update system timestamp of the event that caused this version.

    creator

    Creator of the event that caused this version.

  41. case class VersionedAggregate[S, C, E](id: String, cmdHandler: (S, C) ⇒ Try[E], evtHandler: (S, E) ⇒ S, aggregate: Option[ConcurrentVersions[S, E]] = None)(implicit evidence$1: DomainCmd[C], evidence$2: DomainEvt[E]) extends Product with Serializable

    Permalink

    Manages concurrent versions of an event-sourced aggregate.

    Manages concurrent versions of an event-sourced aggregate.

    S

    Aggregate type.

    C

    Command type.

    E

    Event type.

    id

    Aggregate id

    cmdHandler

    Command handler

    evtHandler

    Event handler

    aggregate

    Aggregate.

Value Members

  1. object AbstractEventsourcedProcessor

    Permalink

    Java API

  2. object ApplicationVersion extends Serializable

    Permalink
  3. object BinaryPayloadManifestFilter extends Serializable

    Permalink
  4. object ConcurrentVersions extends Serializable

    Permalink
  5. object ConcurrentVersionsList extends Product with Serializable

    Permalink
  6. object ConcurrentVersionsTree extends Serializable

    Permalink
  7. object ConfirmedDelivery

    Permalink
  8. object DurableEvent extends Serializable

    Permalink
  9. object EndpointFilters

    Permalink
  10. object EventsourcedProcessor

    Permalink
  11. object EventsourcedView

    Permalink
  12. object EventsourcedWriter

    Permalink
  13. object EventsourcingProtocol

    Permalink
  14. object ReplicationConnection extends Serializable

    Permalink
  15. object ReplicationEndpoint

    Permalink
  16. object ReplicationFilter extends Serializable

    Permalink
  17. object ReplicationProtocol

    Permalink
  18. object ResultHandler

    Permalink
  19. object VectorTime extends Serializable

    Permalink
  20. object VersionedAggregate extends Serializable

    Permalink
  21. package adapter

    Permalink
  22. package crdt

    Permalink
  23. package log

    Permalink
  24. package serializer

    Permalink
  25. package snapshot

    Permalink

Ungrouped