public interface MessageService
Message
.Modifier and Type | Method and Description |
---|---|
Message |
findEagerMessageById(Long msgId)
Finds message by message ID with eager loading.
|
Message |
findMessageById(Long msgId)
Finds message by message ID.
|
List<Message> |
findMessagesByFilter(MessageFilter messageFilter,
long limit)
Finds list of messages that match with given filter.
|
Message |
findPartlyFailedMessage(Duration interval)
Finds ONE message in state
MsgStateEnum.PARTLY_FAILED . |
Message |
findPostponedMessage(Duration interval)
Finds ONE message in state
MsgStateEnum.POSTPONED . |
int |
getCountMessages(MsgStateEnum state,
Duration interval)
Get count of messages in specific state.
|
int |
getCountProcessingMessagesForFunnel(String funnelValue,
Duration idleInterval,
String funnelCompId)
Get count of processing messages for specified funnel value and funnel ID.
|
List<Message> |
getMessagesForGuaranteedOrderForFunnel(String funnelValue,
Duration idleInterval,
boolean excludeFailedState,
String funnelCompId)
Gets list of messages with specified funnel value for guaranteed processing order of messages
for specified funnel.
|
List<Message> |
getMessagesForGuaranteedOrderForRoute(String funnelValue,
boolean excludeFailedState)
Gets list of messages with specified funnel value for guaranteed processing order of whole routes.
|
void |
insertMessage(Message message)
Inserts new message.
|
void |
insertMessages(Collection<Message> messages)
Inserts new messages.
|
void |
setFunnelComponentId(Message msg,
String funnelCompId)
Sets funnel component identifier to specified message.
|
void |
setStateFailed(Message msg,
ErrorExtEnum errCode,
String errDesc)
Changes state of the message to
MsgStateEnum.FAILED . |
void |
setStateFailed(Message msg,
Exception ex,
ErrorExtEnum errCode,
String customData,
Map<String,Object> props)
Changes state of the message to
MsgStateEnum.FAILED . |
boolean |
setStateInQueueForLock(Message message)
Set state
MsgStateEnum.IN_QUEUE on Message under database lock. |
void |
setStateOk(Message msg,
Map<String,Object> props)
Changes state of the message to
MsgStateEnum.OK . |
void |
setStatePartlyFailed(Message msg,
Exception ex,
ErrorExtEnum errCode,
String customData,
Map<String,Object> props)
Changes state of the message to
MsgStateEnum.PARTLY_FAILED . |
void |
setStatePartlyFailedWithoutError(Message msg)
Changes state of the message to
MsgStateEnum.PARTLY_FAILED but without increasing error count. |
void |
setStatePostponed(Message msg)
Changes state of the message to
MsgStateEnum.POSTPONED . |
void |
setStateProcessing(Message msg)
Changes state of the message to
MsgStateEnum.PROCESSING . |
boolean |
setStateProcessingForLock(Message message)
Set state
MsgStateEnum.PROCESSING on Message under database lock. |
void |
setStateWaiting(Message msg)
Changes state of the message to
MsgStateEnum.WAITING - only if the message hasn't been already processed. |
void |
setStateWaitingForResponse(Message msg)
Changes state of the message to
MsgStateEnum.WAITING_FOR_RES . |
static final String BEAN
void insertMessage(Message message)
message
- message that will be savedvoid insertMessages(Collection<Message> messages)
messages
- the collection of messagevoid setStateOk(@Header(value="processingMessage") Message msg, @Properties Map<String,Object> props)
MsgStateEnum.OK
.
If message is child message then method checks if all child messages of the parent message aren't processed.
msg
- the messageprops
- the exchange properties [property name; property value]void setStateProcessing(Message msg)
MsgStateEnum.PROCESSING
.msg
- the messagevoid setStateWaiting(@Header(value="processingMessage") Message msg)
MsgStateEnum.WAITING
- only if the message hasn't been already processed.msg
- the messagevoid setStateWaitingForResponse(@Header(value="processingMessage") Message msg)
MsgStateEnum.WAITING_FOR_RES
.msg
- the messagevoid setStatePartlyFailedWithoutError(@Header(value="processingMessage") Message msg)
MsgStateEnum.PARTLY_FAILED
but without increasing error count.msg
- the messagevoid setStatePartlyFailed(@Header(value="processingMessage") Message msg, Exception ex, @ExchangeProperty(value="exceptionErrorCode") @Nullable ErrorExtEnum errCode, @ExchangeProperty(value="customData") @Nullable String customData, @Properties Map<String,Object> props)
MsgStateEnum.PARTLY_FAILED
.msg
- the messageex
- the exceptionerrCode
- the error code that can be explicitly defined if neededcustomData
- the custom dataprops
- the exchange properties [property name; property value]void setStateFailed(@Header(value="processingMessage") Message msg, Exception ex, @ExchangeProperty(value="exceptionErrorCode") @Nullable ErrorExtEnum errCode, @ExchangeProperty(value="customData") @Nullable String customData, @Properties Map<String,Object> props)
MsgStateEnum.FAILED
.
If message is child message then parent message will be marked as failed too.
msg
- the messageex
- the exceptionerrCode
- the error code that can be explicitly defined if neededcustomData
- the custom dataprops
- the exchange properties [property name; property value]void setStateFailed(Message msg, ErrorExtEnum errCode, String errDesc)
MsgStateEnum.FAILED
.
If message is child message then parent message will be marked as failed too.
msg
- the messageerrCode
- the error codeerrDesc
- the error descriptionboolean setStateInQueueForLock(Message message)
MsgStateEnum.IN_QUEUE
on Message
under database lock.message
- message on which will be state changedtrue
- state was successfully changed, false
- otherwiseboolean setStateProcessingForLock(Message message)
MsgStateEnum.PROCESSING
on Message
under database lock.message
- message on which will be state changedtrue
- state was successfully changed, false
- otherwise@Nullable Message findMessageById(Long msgId)
msgId
- the message IDnull
if not found message with specified ID@Nullable Message findEagerMessageById(Long msgId)
msgId
- the message IDnull
if not found message with specified IDList<Message> findMessagesByFilter(MessageFilter messageFilter, long limit)
messageFilter
- the filter.limit
- the limit of message count.empty list
if none were found.int getCountMessages(MsgStateEnum state, @Nullable Duration interval)
state
- State of messageinterval
- searching messages updated after this interval (in seconds)int getCountProcessingMessagesForFunnel(String funnelValue, Duration idleInterval, String funnelCompId)
funnelValue
- the funnel valueidleInterval
- interval (in seconds) that determines how long can be message processingfunnelCompId
- the funnel component IDList<Message> getMessagesForGuaranteedOrderForRoute(String funnelValue, boolean excludeFailedState)
funnelValue
- the funnel valueexcludeFailedState
- FAILED
state is used by default;
use true
if you want to exclude FAILED statemessage timestamp
List<Message> getMessagesForGuaranteedOrderForFunnel(String funnelValue, Duration idleInterval, boolean excludeFailedState, String funnelCompId)
funnelValue
- the funnel valueidleInterval
- interval (in seconds) that determines how long can message be processingexcludeFailedState
- FAILED
state is used by default;
use true
if you want to exclude FAILED statefunnelCompId
- the funnel component IDmessage timestamp
void setStatePostponed(@Header(value="processingMessage") Message msg)
MsgStateEnum.POSTPONED
.msg
- the messagevoid setFunnelComponentId(Message msg, String funnelCompId)
msg
- the messagefunnelCompId
- the funnel component ID@Nullable Message findPostponedMessage(Duration interval)
MsgStateEnum.POSTPONED
.interval
- Interval (in seconds) after that can be postponed message processed again@Nullable Message findPartlyFailedMessage(Duration interval)
MsgStateEnum.PARTLY_FAILED
.interval
- Interval (in seconds) between two tries of partly failed messages.Copyright © 2018 Pivotal Software, Inc.. All rights reserved.