Class MessageManager
java.lang.Object
com.codeheadsystems.queue.manager.MessageManager
The Message manager. This links the DAO with the model. Right now they
are tightly coupled, but by only having the DAO used here, we enforce
that should it need to change we can.
-
Constructor Summary
ConstructorsConstructorDescriptionMessageManager(MessageDao dao, MessageFactory messageFactory, com.codeheadsystems.metrics.Metrics metrics) Instantiates a new Message manager. -
Method Summary
Modifier and TypeMethodDescriptionvoidClear.voidclearAll()Clear all.counts()Returns counts of all states.getPendingMessages(int limit) Gets pending messages, up to the limit.Gets state.saveMessage(String messageType, String payload) Save message optional.voidsetActivating(Message message) Sets activating.voidSets all to pending.voidsetProcessing(Message message) Sets processing.
-
Constructor Details
-
MessageManager
@Inject public MessageManager(MessageDao dao, MessageFactory messageFactory, com.codeheadsystems.metrics.Metrics metrics) Instantiates a new Message manager.- Parameters:
dao- the daomessageFactory- the message factorymetrics- the metrics
-
-
Method Details
-
saveMessage
Save message optional.- Parameters:
messageType- the message typepayload- the payload- Returns:
- the optional
-
setProcessing
Sets processing.- Parameters:
message- the message
-
setActivating
Sets activating.- Parameters:
message- the message
-
setAllToPending
public void setAllToPending()Sets all to pending. -
getPendingMessages
Gets pending messages, up to the limit. Oldest first.- Parameters:
limit- count of messages to get.- Returns:
- the list.
-
counts
Returns counts of all states.- Returns:
- the map
-
getState
Gets state.- Parameters:
message- the message- Returns:
- the state
-
clearAll
public void clearAll()Clear all. -
clear
Clear.- Parameters:
message- the message
-