Class

no.nextgentel.oss.akkatools.aggregate

GeneralAggregate

Related Doc: package aggregate

Permalink

abstract class GeneralAggregate[E, S <: AggregateState[E, S]] extends EnhancedPersistentShardingActor[E, AggregateError]

Dispatcher - When sending something to an ES, use its dispatcher Command - Dispatchable message - When sent to the dispatcher, it will be sent to the correct ES.

Event - Represents a change of state for an ES

State is immutable. Represents the full state of the entity. based on its state it can accept or reject an event. Has with method transition(event) - if ok, it returns new state. If not, an error is thrown.

Can be used to try an event (since it is mutable)

DurableMessage: method of sending a message which with retry-mechanism until confirm() is called.

GeneralAggregate pseudocode:

for each received cmd: convert it to event try the event (by calling state.transition() ) if it failed: maybe do something if it works: persist event generate and send DurableMessages change our current state (by calling state.transition() and keeping the result )

E

Superclass/trait representing your events

S

The type representing your state

Linear Supertypes
EnhancedPersistentShardingActor[E, AggregateError], EnhancedPersistentActor[E, AggregateError], MdcSupport[E], BeforeAndAfterEventAndCommand[E], DiagnosticActorLogging, AtLeastOnceDelivery, AtLeastOnceDeliveryLike, PersistentActor, Eventsourced, PersistenceRecovery, PersistenceIdentity, StashFactory, Stash, RequiresMessageQueue[DequeBasedMessageQueueSemantics], UnrestrictedStash, StashSupport, Snapshotter, Actor, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. GeneralAggregate
  2. EnhancedPersistentShardingActor
  3. EnhancedPersistentActor
  4. MdcSupport
  5. BeforeAndAfterEventAndCommand
  6. DiagnosticActorLogging
  7. AtLeastOnceDelivery
  8. AtLeastOnceDeliveryLike
  9. PersistentActor
  10. Eventsourced
  11. PersistenceRecovery
  12. PersistenceIdentity
  13. StashFactory
  14. Stash
  15. RequiresMessageQueue
  16. UnrestrictedStash
  17. StashSupport
  18. Snapshotter
  19. Actor
  20. AnyRef
  21. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new GeneralAggregate(dmSelf: ActorPath)(implicit arg0: ClassTag[E], arg1: ClassTag[S])

    Permalink

    dmSelf

    dmSelf is used as the address where the DM-confirmation-messages should be sent. In a sharding environment, this has to be our dispatcher which knows how to reach the sharding mechanism. If null, we'll fallback to self - useful when testing

Type Members

  1. case class GenerateDMInfo(generateDMViaEvent: Option[PartialFunction[E, ResultingDurableMessages]], generateDMViaState: Option[PartialFunction[S, ResultingDurableMessages]], generateDMViaStateAndEvent: Option[PartialFunction[(S, E), ResultingDurableMessages]], applyEventBefore: Boolean) extends Product with Serializable

    Permalink
    Attributes
    protected
  2. type Receive = PartialFunction[Any, Unit]

    Permalink
    Definition Classes
    Actor

Abstract Value Members

  1. abstract def cmdToEvent: PartialFunction[AggregateCmd, ResultingEvent[E]]

    Permalink
  2. abstract def persistenceIdBase(): String

    Permalink
  3. abstract val state: S

    Permalink

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def afterOnEvent(): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    BeforeAndAfterEventAndCommand
  5. def afterTryCommand(): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    BeforeAndAfterEventAndCommand
  6. def aroundPostRestart(reason: Throwable): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Eventsourced → Actor
  7. def aroundPostStop(): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    AtLeastOnceDeliveryLike → Eventsourced → Actor
  8. def aroundPreRestart(reason: Throwable, message: Option[Any]): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    AtLeastOnceDeliveryLike → Eventsourced → Actor
  9. def aroundPreStart(): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Eventsourced → Actor
  10. def aroundReceive(receive: akka.actor.Actor.Receive, msg: Any): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    DiagnosticActorLogging → Actor
  11. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  12. def beforeOnEvent(event: E): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    MdcSupportBeforeAndAfterEventAndCommand
  13. def beforeTryCommand(cmd: AnyRef): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    MdcSupportBeforeAndAfterEventAndCommand
  14. def canSendAsDurableMessage(): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  15. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  16. def confirmDelivery(deliveryId: Long): Boolean

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  17. implicit val context: ActorContext

    Permalink
    Definition Classes
    Actor
  18. var currentLogLevelInfo: Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  19. def defaultMdc(): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    MdcSupport
  20. def defaultTimeToWaitAfterMaxRedeliverAttemptsBeforeTimeout(): FiniteDuration

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  21. def deferAsync[A](event: A)(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  22. def deleteMessages(toSequenceNr: Long): Unit

    Permalink
    Definition Classes
    Eventsourced
  23. def deleteSnapshot(sequenceNr: Long): Unit

    Permalink
    Definition Classes
    Snapshotter
  24. def deleteSnapshots(criteria: SnapshotSelectionCriteria): Unit

    Permalink
    Definition Classes
    Snapshotter
  25. def deliver(destination: ActorSelection)(deliveryIdToMessage: (Long) ⇒ Any): Unit

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  26. def deliver(destination: ActorPath)(deliveryIdToMessage: (Long) ⇒ Any): Unit

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  27. lazy val dispatchId: String

    Permalink
  28. def doUnconfirmedWarningProcessing(): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  29. def durableMessageNotDeliveredHandler(originalPayload: Any, errorMsg: String): Unit

    Permalink

    If doUnconfirmedWarningProcessing is turned on, then override this method to try to do something useful before we give up

    If doUnconfirmedWarningProcessing is turned on, then override this method to try to do something useful before we give up

    Attributes
    protected
    Definition Classes
    GeneralAggregateEnhancedPersistentActor
  30. implicit val ec: ExecutionContextExecutor

    Permalink
    Definition Classes
    EnhancedPersistentActor
  31. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  32. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  33. def extractMdc(eventOrCmd: AnyRef): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    MdcSupport
  34. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  35. def generateDM: PartialFunction[S, ResultingDurableMessages]

    Permalink
  36. def generateDMAfter: PartialFunction[E, ResultingDurableMessages]

    Permalink
  37. def generateDMBefore: PartialFunction[E, ResultingDurableMessages]

    Permalink
  38. def generateDMSE: PartialFunction[(S, E), ResultingDurableMessages]

    Permalink
  39. def generateEventsForFailedDurableMessage(originalPayload: Any, errorMsg: String): Seq[E]

    Permalink

    Override this to decide if the failed outbound durableMessage should result in a persisted event.

    Override this to decide if the failed outbound durableMessage should result in a persisted event. If so, return these events. When these have been persisted, generateResultingDurableMessages() will be called as usual enabling you to perform some outbound action.

  40. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  41. def getDMSelf(): ActorPath

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentShardingActorEnhancedPersistentActor
  42. def getDeliverySnapshot: AtLeastOnceDeliverySnapshot

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  43. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  44. def idleTimeout(): FiniteDuration

    Permalink
    Definition Classes
    EnhancedPersistentActor
  45. lazy val idleTimeoutValueToUse: FiniteDuration

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  46. def internalProcessUnconfirmedWarning(unconfirmedWarning: UnconfirmedWarning): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    GeneralAggregateEnhancedPersistentActor
  47. def isExpectedError(e: Exception): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  48. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  49. def journalPluginId: String

    Permalink
    Definition Classes
    PersistenceIdentity
  50. def lastSequenceNr: Long

    Permalink
    Definition Classes
    Eventsourced
  51. def loadSnapshot(persistenceId: String, criteria: SnapshotSelectionCriteria, toSequenceNr: Long): Unit

    Permalink
    Definition Classes
    Snapshotter
  52. val log: DiagnosticLoggingAdapter

    Permalink
    Definition Classes
    DiagnosticActorLogging
  53. def logMessage(message: String): Unit

    Permalink
    Definition Classes
    EnhancedPersistentActor
  54. def maxUnconfirmedMessages: Int

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  55. def mdc(currentMessage: Any): MDC

    Permalink
    Definition Classes
    MdcSupport → DiagnosticActorLogging
  56. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  57. def nextState(): S

    Permalink
  58. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  59. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  60. def numberOfUnconfirmed: Int

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  61. def onApplyingLiveEvent(event: E): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  62. def onEvent: PartialFunction[E, Unit]

    Permalink
  63. def onInactiveTimeout(): Unit

    Permalink

    Called when actor has been idle for too long..

    Called when actor has been idle for too long..

    If running in sharding, you should stop like this:

    getContext().parent().tell(new ShardRegion.Passivate(PoisonPill.getInstance()), self());

    Attributes
    protected
    Definition Classes
    EnhancedPersistentShardingActorEnhancedPersistentActor
  64. def onPersistFailure(cause: Throwable, event: Any, seqNr: Long): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Eventsourced
  65. def onPersistRejected(cause: Throwable, event: Any, seqNr: Long): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Eventsourced
  66. def onReceiveRecover(event: E): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  67. def onRecoveryFailure(cause: Throwable, event: Option[Any]): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Eventsourced
  68. def persist[A](event: A)(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  69. def persistAll[A](events: Seq[A])(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  70. def persistAllAsync[A](events: Seq[A])(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  71. def persistAndApplyEvent(event: E, successHandler: () ⇒ Unit): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  72. def persistAndApplyEvent(event: E): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  73. def persistAndApplyEvents(events: List[E], successHandler: () ⇒ Unit): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  74. def persistAndApplyEvents(events: List[E]): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  75. def persistAsync[A](event: A)(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
  76. def persistenceId: String

    Permalink
    Definition Classes
    EnhancedPersistentShardingActor → PersistenceIdentity
  77. def postRestart(reason: Throwable): Unit

    Permalink
    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  78. def postStop(): Unit

    Permalink
    Definition Classes
    EnhancedPersistentActor → UnrestrictedStash → Actor
  79. def preRestart(reason: Throwable, message: Option[Any]): Unit

    Permalink
    Definition Classes
    UnrestrictedStash → Actor
  80. def preStart(): Unit

    Permalink
    Definition Classes
    EnhancedPersistentActor → Actor
  81. def previousState(): S

    Permalink
  82. def receive: Receive

    Permalink
    Definition Classes
    PersistentActor → Actor
  83. def receiveCommand: Receive

    Permalink
    Definition Classes
    EnhancedPersistentActor → Eventsourced
  84. def receiveRecover: Receive

    Permalink
    Definition Classes
    EnhancedPersistentActor → Eventsourced
  85. def recovery: Recovery

    Permalink
    Definition Classes
    PersistenceRecovery
  86. def recoveryFinished: Boolean

    Permalink
    Definition Classes
    Eventsourced
  87. def recoveryRunning: Boolean

    Permalink
    Definition Classes
    Eventsourced
  88. def redeliverInterval: FiniteDuration

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  89. def redeliveryBurstLimit: Int

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  90. def saveSnapshot(snapshot: Any): Unit

    Permalink
    Definition Classes
    Snapshotter
  91. implicit final val self: ActorRef

    Permalink
    Definition Classes
    Actor
  92. def sendAsDurableMessage(sendAsDurableMessage: SendAsDurableMessage): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentShardingActorEnhancedPersistentActor
  93. def sendAsDurableMessage(payload: AnyRef, destinationActor: ActorPath): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentShardingActorEnhancedPersistentActor
  94. def sendAsDurableMessage(payload: AnyRef, destinationActor: ActorPath, confirmationRoutingInfo: AnyRef): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  95. final def sender(): ActorRef

    Permalink
    Definition Classes
    Actor
  96. def setDeliverySnapshot(snapshot: AtLeastOnceDeliverySnapshot): Unit

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike
  97. def setLogLevels(eventLogLevelInfo: Boolean, recoveringEventLogLevelInfo: Boolean, cmdLogLevelInfo: Boolean): Unit

    Permalink

    eventLogLevelInfo

    Used when processing events live - not recovering

    recoveringEventLogLevelInfo

    Used when recovering events

    cmdLogLevelInfo

    Used when processing commands

    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  98. def setMdcValue(name: String, value: String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    MdcSupport
  99. def snapshotPluginId: String

    Permalink
    Definition Classes
    PersistenceIdentity
  100. def snapshotSequenceNr: Long

    Permalink
    Definition Classes
    Eventsourced → Snapshotter
  101. def snapshotterId: String

    Permalink
    Definition Classes
    Eventsourced → Snapshotter
  102. def stash(): Unit

    Permalink
    Definition Classes
    StashSupport
  103. def stateInfo(): String

    Permalink
    Attributes
    protected
    Definition Classes
    GeneralAggregateEnhancedPersistentActor
  104. def supervisorStrategy: SupervisorStrategy

    Permalink
    Definition Classes
    Actor
  105. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  106. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  107. def toStringForLogging[T](o: T): String

    Permalink
    Attributes
    protected
    Definition Classes
    EnhancedPersistentActor
  108. final def tryCommand: PartialFunction[AnyRef, Unit]

    Permalink
  109. def unhandled(message: Any): Unit

    Permalink
    Definition Classes
    Eventsourced → Actor
  110. def unstashAll(): Unit

    Permalink
    Definition Classes
    Eventsourced → StashSupport
  111. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  112. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  113. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  114. def warnAfterNumberOfUnconfirmedAttempts: Int

    Permalink
    Definition Classes
    AtLeastOnceDeliveryLike

Deprecated Value Members

  1. def generateResultingDurableMessages: PartialFunction[E, ResultingDurableMessages]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.6) Use generateDMBefore/generateDMAfter/generateDM instead

  2. def persist[A](events: Seq[A])(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
    Annotations
    @deprecated
    Deprecated

    (Since version 2.4) use persistAll instead

  3. def persistAsync[A](events: Seq[A])(handler: (A) ⇒ Unit): Unit

    Permalink
    Definition Classes
    Eventsourced
    Annotations
    @deprecated
    Deprecated

    (Since version 2.4) use persistAllAsync instead

Inherited from MdcSupport[E]

Inherited from BeforeAndAfterEventAndCommand[E]

Inherited from DiagnosticActorLogging

Inherited from AtLeastOnceDelivery

Inherited from AtLeastOnceDeliveryLike

Inherited from PersistentActor

Inherited from Eventsourced

Inherited from PersistenceRecovery

Inherited from PersistenceIdentity

Inherited from StashFactory

Inherited from Stash

Inherited from RequiresMessageQueue[DequeBasedMessageQueueSemantics]

Inherited from UnrestrictedStash

Inherited from StashSupport

Inherited from Snapshotter

Inherited from Actor

Inherited from AnyRef

Inherited from Any

Ungrouped