Class QueueRepositoryImpl
- java.lang.Object
-
- fr.gouv.vitam.storage.offers.tape.impl.queue.QueueRepositoryImpl
-
- All Implemented Interfaces:
QueueRepository
- Direct Known Subclasses:
TapeCatalogRepository
public class QueueRepositoryImpl extends java.lang.Object implements QueueRepository
-
-
Field Summary
Fields Modifier and Type Field Description protected com.mongodb.client.MongoCollection<org.bson.Document>
collection
-
Constructor Summary
Constructors Constructor Description QueueRepositoryImpl(com.mongodb.client.MongoCollection<org.bson.Document> collection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(QueueMessageEntity queue)
void
addIfAbsent(java.util.List<QueryCriteria> criteria, QueueMessageEntity queueMessageEntity)
long
complete(java.lang.String queueId)
Make QueueMessageEntity COMPLETEDjava.util.Map<org.apache.commons.lang3.tuple.Pair<QueueState,QueueMessageType>,java.lang.Integer>
countByStateAndType()
count queue entries grouped by state & message typelong
initializeOnBootstrap()
long
markError(java.lang.String queueMessageId)
Mark queueEntity as Errorlong
markReady(java.lang.String queueMessageId)
Mark queueEntity as READY<T> java.util.Optional<T>
receive(QueueMessageType messageType)
<T> java.util.Optional<T>
receive(QueueMessageType messageType, boolean usePriority)
<T> java.util.Optional<T>
receive(org.bson.conversions.Bson inQuery, QueueMessageType messageType)
<T> java.util.Optional<T>
receive(org.bson.conversions.Bson inQuery, QueueMessageType messageType, boolean usePriority)
long
remove(java.lang.String queueId)
void
tryCancelIfNotStarted(java.util.List<QueryCriteria> criteria)
-
-
-
Method Detail
-
add
public void add(QueueMessageEntity queue) throws QueueException
- Specified by:
add
in interfaceQueueRepository
- Throws:
QueueException
-
addIfAbsent
public void addIfAbsent(java.util.List<QueryCriteria> criteria, QueueMessageEntity queueMessageEntity) throws QueueException
- Specified by:
addIfAbsent
in interfaceQueueRepository
- Throws:
QueueException
-
tryCancelIfNotStarted
public void tryCancelIfNotStarted(java.util.List<QueryCriteria> criteria) throws QueueException
- Specified by:
tryCancelIfNotStarted
in interfaceQueueRepository
- Throws:
QueueException
-
remove
public long remove(java.lang.String queueId) throws QueueException
- Specified by:
remove
in interfaceQueueRepository
- Throws:
QueueException
-
complete
public long complete(java.lang.String queueId) throws QueueException
Description copied from interface:QueueRepository
Make QueueMessageEntity COMPLETED- Specified by:
complete
in interfaceQueueRepository
- Returns:
- Throws:
QueueException
-
markError
public long markError(java.lang.String queueMessageId) throws QueueException
Description copied from interface:QueueRepository
Mark queueEntity as Error- Specified by:
markError
in interfaceQueueRepository
- Returns:
- Throws:
QueueException
-
markReady
public long markReady(java.lang.String queueMessageId) throws QueueException
Description copied from interface:QueueRepository
Mark queueEntity as READY- Specified by:
markReady
in interfaceQueueRepository
- Returns:
- Throws:
QueueException
-
initializeOnBootstrap
public long initializeOnBootstrap()
- Specified by:
initializeOnBootstrap
in interfaceQueueRepository
-
receive
public <T> java.util.Optional<T> receive(QueueMessageType messageType) throws QueueException
- Specified by:
receive
in interfaceQueueRepository
- Throws:
QueueException
-
receive
public <T> java.util.Optional<T> receive(QueueMessageType messageType, boolean usePriority) throws QueueException
- Specified by:
receive
in interfaceQueueRepository
- Throws:
QueueException
-
receive
public <T> java.util.Optional<T> receive(org.bson.conversions.Bson inQuery, QueueMessageType messageType) throws QueueException
- Specified by:
receive
in interfaceQueueRepository
- Throws:
QueueException
-
receive
public <T> java.util.Optional<T> receive(org.bson.conversions.Bson inQuery, QueueMessageType messageType, boolean usePriority) throws QueueException
- Specified by:
receive
in interfaceQueueRepository
- Throws:
QueueException
-
countByStateAndType
public java.util.Map<org.apache.commons.lang3.tuple.Pair<QueueState,QueueMessageType>,java.lang.Integer> countByStateAndType() throws QueueException
count queue entries grouped by state & message type- Returns:
- number of queue entries by state & message type
- Throws:
QueueException
-
-