abstract class WorkItemModuleRepository[T] extends WorkItemRepository[T]
If you have multiple lifecycles on a WorkItem, you can use the WorkItemModuleRepository
to interact with those lifecycles.
It will namespace the lifecycle fields with the provided moduleName.
It assumes creation of WorkItems are made through another view (e.g. a standard WorkItemRepository), it will
only allow interacting with the WorkItem lifecycle, and will throw runtime exceptions if pushNew or pushNewBatch are called.
- Alphabetic
- By Inheritance
- WorkItemModuleRepository
- WorkItemRepository
- MetricSource
- FindById
- Cancel
- PlayMongoRepository
- MongoDatabaseCollection
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new WorkItemModuleRepository(collectionName: String, moduleName: String, mongoComponent: MongoComponent, replaceIndexes: Boolean = true, extraIndexes: Seq[IndexModel] = Seq.empty, extraCodecs: Seq[Codec[_]] = Seq.empty)(implicit trd: Reads[T], ec: ExecutionContext)
Abstract Value Members
- abstract def inProgressRetryAfter: Duration
Returns the timeout of any WorkItems marked as InProgress.
Returns the timeout of any WorkItems marked as InProgress. WorkItems marked as InProgress will be hidden from pullOutstanding until this window expires.
- Definition Classes
- WorkItemRepository
- abstract def now(): Instant
Returns the current date time for setting the updatedAt field.
Returns the current date time for setting the updatedAt field. abstract to allow for test friendly implementations.
- Definition Classes
- WorkItemRepository
Concrete 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 cancel(id: ObjectId): Future[StatusUpdateResult]
Sets the ProcessingStatus of a WorkItem to Cancelled.
Sets the ProcessingStatus of a WorkItem to Cancelled.
- returns
StatusUpdateResult.Updated if the WorkItem is cancelled, StatusUpdateResult.NotFound if it's not found, and StatusUpdateResult.NotUpdated if it's not in a cancellable ProcessingStatus.
- Definition Classes
- WorkItemRepository → Cancel
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- lazy val collection: MongoCollection[WorkItem[T]]
- Definition Classes
- PlayMongoRepository
- final val collectionName: String
- Definition Classes
- PlayMongoRepository → MongoDatabaseCollection
- def complete(id: ObjectId, newStatus: ResultStatus): Future[Boolean]
Sets the ProcessingStatus of a WorkItem to a ResultStatus.
Sets the ProcessingStatus of a WorkItem to a ResultStatus. It will also update the updatedAt timestamp. It will return false if the WorkItem is not InProgress.
- Definition Classes
- WorkItemRepository
- def completeAndDelete(id: ObjectId): Future[Boolean]
Deletes the WorkItem.
Deletes the WorkItem. It will return false if the WorkItem is not InProgress.
- Definition Classes
- WorkItemRepository
- def count(state: ProcessingStatus): Future[Long]
Returns the number of WorkItems in the specified ProcessingStatus
Returns the number of WorkItems in the specified ProcessingStatus
- Definition Classes
- WorkItemRepository
- final val domainFormat: Format[WorkItem[T]]
- Definition Classes
- PlayMongoRepository
- def ensureIndexes(): Future[Seq[String]]
- Definition Classes
- PlayMongoRepository
- def ensureSchema(): Future[Unit]
- Definition Classes
- PlayMongoRepository
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def findById(id: ObjectId): Future[Option[WorkItem[T]]]
- Definition Classes
- WorkItemRepository → FindById
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final val indexes: Seq[IndexModel]
- Definition Classes
- PlayMongoRepository → MongoDatabaseCollection
- lazy val initialised: Future[Unit]
- Definition Classes
- PlayMongoRepository
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def markAs(id: ObjectId, status: ProcessingStatus, availableAt: Option[Instant] = None): Future[Boolean]
Sets the ProcessingStatus of a WorkItem.
Sets the ProcessingStatus of a WorkItem. It will also update the updatedAt timestamp.
- Definition Classes
- WorkItemRepository
- lazy val metricPrefix: String
- Definition Classes
- WorkItemModuleRepository → WorkItemRepository
- def metrics(implicit ec: ExecutionContext): Future[Map[String, Int]]
- Definition Classes
- WorkItemRepository → MetricSource
- 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 val optSchema: Option[BsonDocument]
- Definition Classes
- PlayMongoRepository
- def pullOutstanding(failedBefore: Instant, availableBefore: Instant): Future[Option[WorkItem[T]]]
Returns a WorkItem to be processed, if available.
Returns a WorkItem to be processed, if available. The item will be atomically set to ProcessingStatus.InProgress, so it will not be picked up by other calls to pullOutstanding until it's status has been explicitly marked as Failed or ToDo, or it's progress status has timed out (set by inProgressRetryAfter).
A WorkItem will be considered for processing in the following order: 1) Has ToDo status, and the availableAt field is before the availableBefore param. 2) Has Failed status, and it was marked as Failed before the failedBefore param. 3) Has InProgress status, and was marked as InProgress before the inProgressRetryAfter configuration. Basically a timeout to ensure WorkItems that don't advance from InProgress do not get stuck.
- failedBefore
it will only consider WorkItems in FailedState if they were marked as Failed before the failedBefore. This can avoid retrying a failure immediately.
- availableBefore
it will only consider WorkItems where the availableAt field is before the availableBefore
- Definition Classes
- WorkItemRepository
- def pushNew(item: T, availableAt: Instant, initialState: (T) => ProcessingStatus): Future[WorkItem[T]]
Creates a new WorkItem.
Creates a new WorkItem.
- item
the item to store in the WorkItem
- availableAt
when to defer processing until
- initialState
defines the initial state of the WorkItem for the item
- Definition Classes
- WorkItemModuleRepository → WorkItemRepository
- def pushNewBatch(items: Seq[T], availableAt: Instant, initialState: (T) => ProcessingStatus): Future[Seq[WorkItem[T]]]
Creates a batch of new WorkItems.
Creates a batch of new WorkItems.
- items
the items to store as WorkItems
- availableAt
when to defer processing until
- initialState
defines the initial state of the WorkItems for the item
- Definition Classes
- WorkItemModuleRepository → WorkItemRepository
- lazy val requiresTtlIndex: Boolean
- Attributes
- protected[mongo]
- Definition Classes
- PlayMongoRepository
- 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()
- val workItemFields: WorkItemFields
- Definition Classes
- WorkItemRepository