public class MessageCountRestartStrategy extends java.lang.Object implements RestartStrategy
This RestartStrategy monitors the number of messages processed and if this number passes our maximum threshold, then this strategy will return true upon requiresRestart(). Finally upon calling requiresRestart, should we return true, we will also reset the internal number of messages processed count back down to zero.
The default max-messages-count is set to 50.
In the adapter configuration file this class is aliased as message-count-restart-strategy which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
MessageCountRestartStrategy() |
Modifier and Type | Method and Description |
---|---|
int |
getMaxMessagesCount() |
void |
messageProcessed(AdaptrisMessage msg)
Mark the current message as processed.
|
boolean |
requiresRestart()
Whether or not a restart of the underlying service is required.
|
void |
setMaxMessagesCount(int maxMessagesCount) |
public void messageProcessed(AdaptrisMessage msg)
RestartStrategy
messageProcessed
in interface RestartStrategy
msg
- the message currently being processed.public boolean requiresRestart()
RestartStrategy
requiresRestart
in interface RestartStrategy
public int getMaxMessagesCount()
public void setMaxMessagesCount(int maxMessagesCount)