public class FsImmediateEventPoller extends PollerImp
Implementation of Poller
which listens for file events. Whenever a file is created this even based poller, will be
triggered immediately.
Note; This poller implementation should only be used with file system Consumers. And you must configure a (> 0) quiet-period for your fs consumer. The quiet period is used to check that the file has completed it's creation.
This poller will only trigger the consumer once a file has completed it's creation. The reason for this is that you may have a big file that starts to be created, this poller will be immediately invoked. If we were to hand over to the consumer at this point (while the file is still copying) the consumer has it's own check to make sure the file has been created in full and therefore not process the file. Instead it assumes there will be another poll shortly. However, if more files are not added to our "in" directory for a while, this event will not happen until more files are added. In these situations we could end up not processing files until the next file is added.
In the adapter configuration file this class is aliased as fs-immediate-event-poller which is the preferred alternative to the fully qualified classname when building your configuration.
PollerImp.Callback
Constructor and Description |
---|
FsImmediateEventPoller() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
TimeInterval |
getCreationCompleteCheck() |
void |
init()
Initialises the component.
|
void |
setCreationCompleteCheck(TimeInterval t)
Specify the wait time between checking for file creation.
|
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
attemptLock, processMessages, registerConsumer, releaseLock, retrieveConsumer, retrieveConsumer, withPollerCallback
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
CoreException
- wrapping any underlying Exception
spublic void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
CoreException
- wrapping any underlying Exception
spublic void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
public void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
public TimeInterval getCreationCompleteCheck()
public void setCreationCompleteCheck(TimeInterval t)
t
- the time interval; default is 500ms.