public class FileEventHandler extends java.lang.Object implements EventHandlerIF
Constructor and Description |
---|
FileEventHandler() |
Modifier and Type | Method and Description |
---|---|
int |
getEventCount()
Get the number of events in the queue that are ready to be processed.
|
int |
getEventCountToRetry()
Get the number of failed events in the queue that are ready to be retried.
|
MoMaLauncherTriggerEvent |
getNextEvent()
Get the next event in the queue.
|
MoMaLauncherTriggerEvent |
getNextEventToRetry()
Get the next event to retry
The implementation should only return events with a retry count < MoMaLauncher.maxRetryCount and an
event time older than now() - MoMaLauncher.RetryIntervalSeconds.
|
int |
getPermanentErrorCount()
Get the number of failed events in the queue that have reached the maximum retry count.
|
boolean |
init(java.util.Properties p)
Does the initialization.
|
void |
removeTriggerFile(MoMaLauncherTriggerEvent event) |
void |
setContext(XSDContextIF ctx)
Set the context for the event handler.
|
void |
setEventState(MoMaLauncherTriggerEvent event,
MoMaLauncherTriggerEvent.EventState state)
Set the state of an event
|
void |
setLogger(java.util.logging.Logger logger)
Pass the logger to the event handler to enable logging to the same file as the MoMaLauncher
|
void |
setMaxRetryCount(int maxRetryCount)
Set the maximum number of attempts to retry a failed event
|
void |
setMinEventAgeSeconds(int minEventAgeSeconds)
Set the number of seconds to wait before an event is processed.
|
void |
setNotConnectedSleepTime(int notConnectedSleepTime)
Set the number of seconds to wait before connection to the trigger source is retried after a disconnect.
|
void |
setRetryIntervalSeconds(int retryIntervalSeconds)
Set the number of seconds to wait before a failed event is retried.
|
public MoMaLauncherTriggerEvent getNextEvent()
EventHandlerIF
getNextEvent
in interface EventHandlerIF
public int getEventCount()
EventHandlerIF
getEventCount
in interface EventHandlerIF
public void removeTriggerFile(MoMaLauncherTriggerEvent event)
public void setEventState(MoMaLauncherTriggerEvent event, MoMaLauncherTriggerEvent.EventState state)
EventHandlerIF
setEventState
in interface EventHandlerIF
event
- The event to modifystate
- The new statepublic boolean init(java.util.Properties p)
EventHandlerIF
init
in interface EventHandlerIF
p
- The properties. All Properties defined for the MoMaLauncher are passed to the
EventHandlerpublic void setLogger(java.util.logging.Logger logger)
EventHandlerIF
setLogger
in interface EventHandlerIF
logger
- The logger defined for the MoMaLauncherpublic void setContext(XSDContextIF ctx)
EventHandlerIF
setContext
in interface EventHandlerIF
ctx
- The context used by the MoMaLauncherpublic int getEventCountToRetry()
EventHandlerIF
getEventCountToRetry
in interface EventHandlerIF
public MoMaLauncherTriggerEvent getNextEventToRetry()
EventHandlerIF
getNextEventToRetry
in interface EventHandlerIF
public void setMinEventAgeSeconds(int minEventAgeSeconds)
EventHandlerIF
setMinEventAgeSeconds
in interface EventHandlerIF
public void setMaxRetryCount(int maxRetryCount)
EventHandlerIF
setMaxRetryCount
in interface EventHandlerIF
public void setRetryIntervalSeconds(int retryIntervalSeconds)
EventHandlerIF
setRetryIntervalSeconds
in interface EventHandlerIF
retryIntervalSeconds
- The number of seconds to waitpublic int getPermanentErrorCount()
EventHandlerIF
getPermanentErrorCount
in interface EventHandlerIF
public void setNotConnectedSleepTime(int notConnectedSleepTime)
EventHandlerIF
setNotConnectedSleepTime
in interface EventHandlerIF