< Back
 

# Packages

-  package root
  Definition Classes
    root
-  package uk
  Definition Classes
    root
-  package gov
  Definition Classes
    uk
-  package hmrc
  Definition Classes
    gov
-  package workitem
  Definition Classes
    hmrc
- Operations
- ProcessingStatus
- ResultStatus
- StatusUpdateResult
- WorkItem
- WorkItemFieldNames
- WorkItemModuleRepository
- WorkItemRepository

c

uk.gov.hmrc.workitem

# WorkItemModuleRepository 

###
Companion object WorkItemModuleRepository

#### abstract class WorkItemModuleRepository[T] extends WorkItemRepository[T, ObjectId]

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` is called.

Linear Supertypes
WorkItemRepository[T, ObjectId], MetricSource, FindById[ObjectId, T], Cancel[ObjectId], PlayMongoRepository[WorkItem[T]], MongoDatabaseCollection, AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. WorkItemModuleRepository
2. WorkItemRepository
3. MetricSource
4. FindById
5. Cancel
6. PlayMongoRepository
7. MongoDatabaseCollection
8. AnyRef
9. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new WorkItemModuleRepository(collectionName: String, moduleName: String, mongoComponent: MongoComponent, config: Config, replaceIndexes: Boolean = true)(implicit trd: Reads[T], ec: ExecutionContext)

### Abstract Value Members

1.  abstract def inProgressRetryAfterProperty: String

   Returns the property key which defines the millis in Long format, for the inProgressRetryAfter to be looked up in the config.

   Returns the property key which defines the millis in Long format, for the inProgressRetryAfter to be looked up in the config.

   Definition Classes
     WorkItemRepository
2.  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

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  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
6.  def clone(): AnyRef
   Attributes
     protected[lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( ... ) @native()
7.  val collection: MongoCollection[WorkItem[T]]
   Definition Classes
     PlayMongoRepository
8.  val collectionName: String
   Definition Classes
     PlayMongoRepository → MongoDatabaseCollection
9.  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
10.  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
11.  val domainFormat: Format[WorkItem[T]]
    Definition Classes
      PlayMongoRepository
12.  def ensureIndexes: Future[Seq[String]]
    Definition Classes
      PlayMongoRepository
13.  def ensureSchema: Future[Unit]
    Definition Classes
      PlayMongoRepository
14.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
15.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
16.  def finalize(): Unit
    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
17.  def findById(id: ObjectId): Future[Option[WorkItem[T]]]
    Definition Classes
      WorkItemRepository → FindById
18.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
19.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
20.  lazy val 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
21.  val indexes: Seq[IndexModel]
    Definition Classes
      PlayMongoRepository → MongoDatabaseCollection
22.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
23.  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
24.  lazy val metricPrefix: String
    Definition Classes
      WorkItemModuleRepository → WorkItemRepository
25.  def metrics(implicit ec: ExecutionContext): Future[Map[String, Int]]
    Definition Classes
      WorkItemRepository → MetricSource
26.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
27.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
28.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
29.  val optSchema: Option[BsonDocument]
    Definition Classes
      PlayMongoRepository
30.  def protectFromWrites: Nothing
31.  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 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
32.  def pushNew(items: Seq[T], receivedAt: Instant, initialState: (T) ⇒ ProcessingStatus): Future[Seq[WorkItem[T]]]

    Creates a batch of new WorkItems with availableAt equal to receivedAt

    Creates a batch of new WorkItems with availableAt equal to receivedAt

    Definition Classes
      WorkItemModuleRepository → WorkItemRepository
33.  def pushNew(items: Seq[T], receivedAt: Instant): Future[Seq[WorkItem[T]]]

    Creates a batch of new WorkItems with status ToDo and availableAt equal to receivedAt

    Creates a batch of new WorkItems with status ToDo and availableAt equal to receivedAt

    Definition Classes
      WorkItemModuleRepository → WorkItemRepository
34.  def pushNew(item: T, receivedAt: Instant, initialState: (T) ⇒ ProcessingStatus): Future[WorkItem[T]]

    Creates a new WorkItem with availableAt equal to receivedAt

    Creates a new WorkItem with availableAt equal to receivedAt

    Definition Classes
      WorkItemModuleRepository → WorkItemRepository
35.  def pushNew(item: T, receivedAt: Instant): Future[WorkItem[T]]

    Creates a new WorkItem with status ToDo and availableAt equal to receivedAt

    Creates a new WorkItem with status ToDo and availableAt equal to receivedAt

    Definition Classes
      WorkItemModuleRepository → WorkItemRepository
36.  def pushNew(items: Seq[T], receivedAt: Instant, 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

    receivedAt

      when the items were received

    availableAt

      when to defer processing until

    initialState

      defines the initial state of the WorkItems for the item

    Definition Classes
      WorkItemRepository
37.  def pushNew(item: T, receivedAt: Instant, availableAt: Instant, initialState: (T) ⇒ ProcessingStatus): Future[WorkItem[T]]

    Creates a new WorkItem.

    Creates a new WorkItem.

    item

      the item to store in the WorkItem

    receivedAt

      when the item was received

    availableAt

      when to defer processing until

    initialState

      defines the initial state of the WorkItem for the item

    Definition Classes
      WorkItemRepository
38.  def pushNew(item: T, receivedAt: Instant, availableAt: Instant): Future[WorkItem[T]]

    Creates a new WorkItem with status ToDo

    Creates a new WorkItem with status ToDo

    Definition Classes
      WorkItemRepository
39.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
40.  def toString(): String
    Definition Classes
      AnyRef → Any
41.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
42.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
43.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... ) @native()
44.  val workItemFields: WorkItemFieldNames
    Definition Classes
      WorkItemRepository

### Inherited from WorkItemRepository[T, ObjectId]

### Inherited from MetricSource

### Inherited from FindById[ObjectId, T]

### Inherited from Cancel[ObjectId]

### Inherited from PlayMongoRepository[WorkItem[T]]

### Inherited from MongoDatabaseCollection

### Inherited from AnyRef

### Inherited from Any

### Ungrouped