@Repository public class MessageDaoJpaImpl extends Object implements MessageDao
MessageDao
interface.Modifier and Type | Field and Description |
---|---|
static int |
MAX_MESSAGES_IN_ONE_QUERY |
Constructor and Description |
---|
MessageDaoJpaImpl() |
Modifier and Type | Method and Description |
---|---|
Message |
findByCorrelationId(String correlationId,
ExternalSystemExtEnum sourceSystem)
Finds message by source system and correlation ID.
|
List<Message> |
findChildMessages(Message msg)
Finds all child messages of specified parent message.
|
List<Message> |
findChildMessagesForParent(Message parentMessage)
Finds all child message for parent message.
|
Message |
findEagerMessage(Long msgId)
Finds message by its ID with eager loading.
|
Message |
findMessage(Long msgId)
Finds message by its ID.
|
List<Message> |
findMessagesByFilter(MessageFilter filter,
long limit)
Finds messages by multiple fields, hold together in MessageFilter.
|
protected String |
findMessagesByFilterFulltextSql(String placeholder)
Fulltext SQL used with fulltext field of messageFilter in operation findMessagesByFilter.
|
Message |
findPartlyFailedMessage(Duration interval)
Finds ONE message in state
MsgStateEnum.PARTLY_FAILED . |
Message |
findPostponedMessage(Duration interval)
Finds ONE message in state
MsgStateEnum.POSTPONED . |
List<Message> |
findProcessingMessages(Duration interval)
Finds processing messages to repair process.
|
int |
getCountMessages(MsgStateEnum state,
Duration interval)
Gets count of messages in specified state
|
int |
getCountProcessingMessagesForFunnel(String funnelValue,
Duration idleInterval,
String funnelCompId)
Gets count of processing messages (PROCESSING, WAITING, WAITING_FOR_RES) with same funnel value
and for specified funnel ID.
|
Message |
getMessage(Long msgId)
Gets message by its 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 |
insert(Message msg)
Inserts new message.
|
void |
update(Message msg)
Updates message.
|
boolean |
updateMessageInQueueUnderLock(Message msg,
Node processingNode)
Updates
Message into state MsgStateEnum.IN_QUEUE (set start timestamp in queue)
- gets lock for message. |
boolean |
updateMessageProcessingUnderLock(Message msg,
Node processingNode)
Updates
Message into state MsgStateEnum.PROCESSING (set start timestamp of processing)
- gets lock for message. |
public static final int MAX_MESSAGES_IN_ONE_QUERY
@Transactional(propagation=MANDATORY) public void insert(Message msg)
MessageDao
insert
in interface MessageDao
msg
- the message@Transactional(propagation=MANDATORY) public void update(Message msg)
MessageDao
update
in interface MessageDao
msg
- the message@Nullable public Message findMessage(Long msgId)
MessageDao
findMessage
in interface MessageDao
msgId
- the message IDnull
if not available@Nullable public Message findEagerMessage(Long msgId)
MessageDao
findEagerMessage
in interface MessageDao
msgId
- the message IDnull
if not availablepublic Message getMessage(Long msgId)
MessageDao
getMessage
in interface MessageDao
msgId
- the message IDpublic List<Message> findChildMessages(Message msg)
MessageDao
findChildMessages
in interface MessageDao
msg
- the messagepublic List<Message> findChildMessagesForParent(Message parentMessage)
MessageDao
findChildMessagesForParent
in interface MessageDao
parentMessage
- parent message@Nullable public Message findByCorrelationId(String correlationId, @Nullable ExternalSystemExtEnum sourceSystem)
MessageDao
findByCorrelationId
in interface MessageDao
correlationId
- correlation IDsourceSystem
- the source systemnull
if not available@Nullable public Message findPartlyFailedMessage(Duration interval)
MessageDao
MsgStateEnum.PARTLY_FAILED
.findPartlyFailedMessage
in interface MessageDao
interval
- Interval (in seconds) between two tries of partly failed messages.@Nullable public Message findPostponedMessage(Duration interval)
MessageDao
MsgStateEnum.POSTPONED
.findPostponedMessage
in interface MessageDao
interval
- Interval (in seconds) after that can be postponed message processed againpublic boolean updateMessageProcessingUnderLock(Message msg, Node processingNode)
MessageDao
Message
into state MsgStateEnum.PROCESSING
(set start timestamp of processing)
- gets lock for message.updateMessageProcessingUnderLock
in interface MessageDao
msg
- the messageprocessingNode
- node that process message from parametertrue
when update was successful otherwise false
public boolean updateMessageInQueueUnderLock(Message msg, Node processingNode)
MessageDao
Message
into state MsgStateEnum.IN_QUEUE
(set start timestamp in queue)
- gets lock for message.updateMessageInQueueUnderLock
in interface MessageDao
msg
- the messageprocessingNode
- node that process message from parametertrue
when update was successful otherwise false
public List<Message> findProcessingMessages(Duration interval)
MessageDao
findProcessingMessages
in interface MessageDao
interval
- Interval (in seconds) after that processing messages are probably in dead-lockpublic int getCountMessages(MsgStateEnum state, @Nullable Duration interval)
MessageDao
getCountMessages
in interface MessageDao
state
- the stateinterval
- Interval (in seconds) after that messages must be updates; in other words get count
of messages updated in specified intervalpublic int getCountProcessingMessagesForFunnel(String funnelValue, Duration idleInterval, String funnelCompId)
MessageDao
getCountProcessingMessagesForFunnel
in interface MessageDao
funnelValue
- the funnel valueidleInterval
- interval (in seconds) that determines how long can be message processingfunnelCompId
- the funnel component IDpublic List<Message> getMessagesForGuaranteedOrderForRoute(String funnelValue, boolean excludeFailedState)
MessageDao
getMessagesForGuaranteedOrderForRoute
in interface MessageDao
funnelValue
- the funnel valueexcludeFailedState
- FAILED
state is used by default;
use true
if you want to exclude FAILED statemessage timestamp
public List<Message> getMessagesForGuaranteedOrderForFunnel(String funnelValue, Duration idleInterval, boolean excludeFailedState, String funnelCompId)
MessageDao
getMessagesForGuaranteedOrderForFunnel
in interface MessageDao
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
public List<Message> findMessagesByFilter(MessageFilter filter, long limit)
MessageDao
findMessagesByFilter
in interface MessageDao
filter
- the filter.limit
- the limit of messages.protected String findMessagesByFilterFulltextSql(String placeholder)
placeholder
- where the actual fulltext string will be.Copyright © 2018 Pivotal Software, Inc.. All rights reserved.