object SlickProjection
Factories of pekko.projection.Projection where the offset is stored in a relational database table using Slick. The envelope handler can integrate with anything, such as publishing to a message broker, or updating a relational read model.
- Annotations
- @ApiMayChange()
- Source
- SlickProjection.scala
- Alphabetic
- By Inheritance
- SlickProjection
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def atLeastOnce[Offset, Envelope, P <: JdbcProfile](projectionId: ProjectionId, sourceProvider: SourceProvider[Offset, Envelope], databaseConfig: DatabaseConfig[P], handler: () => SlickHandler[Envelope])(implicit arg0: ClassTag[P], system: ActorSystem[_]): AtLeastOnceProjection[Offset, Envelope]
Create a pekko.projection.Projection with at-least-once processing semantics.
Create a pekko.projection.Projection with at-least-once processing semantics.
The DBIO returned by the SlickHandler.process() of the provided handler will be wrapped in a transaction.
It stores the offset in a relational database table using Slick after the
handler
has processed the envelope. This means that if the projection is restarted from previously stored offset then some elements may be processed more than once.The offset is stored after a time window, or limited by a number of envelopes, whatever happens first. This window can be defined with AtLeastOnceProjection.withSaveOffset of the returned
AtLeastOnceProjection
. The default settings for the window is defined in configuration sectionpekko.projection.at-least-once
. - def atLeastOnceAsync[Offset, Envelope, P <: JdbcProfile](projectionId: ProjectionId, sourceProvider: SourceProvider[Offset, Envelope], databaseConfig: DatabaseConfig[P], handler: () => Handler[Envelope])(implicit arg0: ClassTag[P], system: ActorSystem[_]): AtLeastOnceProjection[Offset, Envelope]
Create a pekko.projection.Projection with at-least-once processing semantics.
Create a pekko.projection.Projection with at-least-once processing semantics.
Compared to SlickProjection.atLeastOnce the Handler is not storing the projected result in the database, but is integrating with something else.
It stores the offset in a relational database table using Slick after the
handler
has processed the envelope. This means that if the projection is restarted from previously stored offset then some elements may be processed more than once.The offset is stored after a time window, or limited by a number of envelopes, whatever happens first. This window can be defined with AtLeastOnceProjection.withSaveOffset of the returned
AtLeastOnceProjection
. The default settings for the window is defined in configuration sectionpekko.projection.at-least-once
. - def atLeastOnceFlow[Offset, Envelope, P <: JdbcProfile](projectionId: ProjectionId, sourceProvider: SourceProvider[Offset, Envelope], databaseConfig: DatabaseConfig[P], handler: FlowWithContext[Envelope, ProjectionContext, Done, ProjectionContext, _])(implicit arg0: ClassTag[P], system: ActorSystem[_]): AtLeastOnceFlowProjection[Offset, Envelope]
Create a pekko.projection.Projection with a FlowWithContext as the envelope handler.
Create a pekko.projection.Projection with a FlowWithContext as the envelope handler. It has at-least-once processing semantics.
The flow should emit a
Done
element for each completed envelope. The offset of the envelope is carried in the context of theFlowWithContext
and is stored in the database when correspondingDone
is emitted. Since the offset is stored after processing the envelope it means that if the projection is restarted from previously stored offset then some envelopes may be processed more than once.If the flow filters out envelopes the corresponding offset will not be stored, and such envelope will be processed again if the projection is restarted and no later offset was stored.
The flow should not duplicate emitted envelopes (
mapConcat
) with same offset, because then it can result in that the first offset is stored and when the projection is restarted that offset is considered completed even though more of the duplicated enveloped were never processed.The flow must not reorder elements, because the offsets may be stored in the wrong order and and when the projection is restarted all envelopes up to the latest stored offset are considered completed even though some of them may not have been processed. This is the reason the flow is restricted to
FlowWithContext
rather than ordinaryFlow
. - def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def createTablesIfNotExists[P <: JdbcProfile](databaseConfig: DatabaseConfig[P])(implicit arg0: ClassTag[P], system: ActorSystem[_]): Future[Done]
For testing purposes the projection offset and management tables can be created programmatically.
For testing purposes the projection offset and management tables can be created programmatically. For production it's recommended to create the table with DDL statements before the system is started.
- def dropTablesIfExists[P <: JdbcProfile](databaseConfig: DatabaseConfig[P])(implicit arg0: ClassTag[P], system: ActorSystem[_]): Future[Done]
For testing purposes the projection offset and management tables can be dropped programmatically.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def exactlyOnce[Offset, Envelope, P <: JdbcProfile](projectionId: ProjectionId, sourceProvider: SourceProvider[Offset, Envelope], databaseConfig: DatabaseConfig[P], handler: () => SlickHandler[Envelope])(implicit arg0: ClassTag[P], system: ActorSystem[_]): ExactlyOnceProjection[Offset, Envelope]
Create a pekko.projection.Projection with exactly-once processing semantics.
Create a pekko.projection.Projection with exactly-once processing semantics.
It stores the offset in a relational database table using Slick in the same transaction as the DBIO returned from the
handler
. - def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def groupedWithin[Offset, Envelope, P <: JdbcProfile](projectionId: ProjectionId, sourceProvider: SourceProvider[Offset, Envelope], databaseConfig: DatabaseConfig[P], handler: () => SlickHandler[Seq[Envelope]])(implicit arg0: ClassTag[P], system: ActorSystem[_]): GroupedProjection[Offset, Envelope]
Create a pekko.projection.Projection that groups envelopes and calls the
handler
with a group ofEnvelopes
.Create a pekko.projection.Projection that groups envelopes and calls the
handler
with a group ofEnvelopes
. The envelopes are grouped within a time window, or limited by a number of envelopes, whatever happens first. This window can be defined with GroupedProjection.withGroup of the returnedGroupedProjection
. The default settings for the window is defined in configuration sectionpekko.projection.grouped
.It stores the offset in a relational database table using Slick in the same transaction as the DBIO returned from the
handler
. - def groupedWithinAsync[Offset, Envelope, P <: JdbcProfile](projectionId: ProjectionId, sourceProvider: SourceProvider[Offset, Envelope], databaseConfig: DatabaseConfig[P], handler: () => Handler[Seq[Envelope]])(implicit arg0: ClassTag[P], system: ActorSystem[_]): GroupedProjection[Offset, Envelope]
Create a pekko.projection.Projection that groups envelopes and calls the
handler
with a group ofEnvelopes
.Create a pekko.projection.Projection that groups envelopes and calls the
handler
with a group ofEnvelopes
. The envelopes are grouped within a time window, or limited by a number of envelopes, whatever happens first. This window can be defined with GroupedProjection.withGroup of the returnedGroupedProjection
. The default settings for the window is defined in configuration sectionpekko.projection.grouped
.Compared to SlickProjection.groupedWithin the Handler is not storing the projected result in the database, but is integrating with something else.
It stores the offset in a relational database table using Slick immediately after the
handler
has processed the envelopes, but that is still with at-least-once processing semantics. This means that if the projection is restarted from previously stored offset the previous group of envelopes may be processed more than once. - def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Deprecated Value Members
- def createOffsetTableIfNotExists[P <: JdbcProfile](databaseConfig: DatabaseConfig[P])(implicit arg0: ClassTag[P], system: ActorSystem[_]): Future[Done]
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Renamed to createTablesIfNotExists
- def dropOffsetTableIfExists[P <: JdbcProfile](databaseConfig: DatabaseConfig[P])(implicit arg0: ClassTag[P], system: ActorSystem[_]): Future[Done]
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Renamed to dropTablesIfExists