Class FsImmediateEventPoller
- java.lang.Object
-
- com.adaptris.core.PollerImp
-
- com.adaptris.core.fs.FsImmediateEventPoller
-
- All Implemented Interfaces:
ComponentLifecycle
,Poller
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adaptris.core.PollerImp
PollerImp.Callback
-
-
Constructor Summary
Constructors Constructor Description FsImmediateEventPoller()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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-
Methods inherited from class com.adaptris.core.PollerImp
attemptLock, processMessages, registerConsumer, releaseLock, retrieveConsumer, retrieveConsumer, withPollerCallback
-
-
-
-
Method Detail
-
init
public void init() throws CoreException
Description copied from interface:ComponentLifecycle
Initialises the component.Component initialisation includes config verification, creation of connections etc.
- Throws:
CoreException
- wrapping any underlyingException
s
-
start
public void start() throws CoreException
Description copied from interface:ComponentLifecycle
Starts the component.Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling start will begin message delivery.- Throws:
CoreException
- wrapping any underlyingException
s
-
stop
public void stop()
Description copied from interface:ComponentLifecycle
Stop the componentA stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling stop will pause message delivery. Throwing aRuntimeException
may cause unintended consequences
-
close
public void close()
Description copied from interface:ComponentLifecycle
Closes the component.A closed component should release any connections it uses, etc. and clean up completely. Throwing a
RuntimeException
may cause unintended consequences
-
getCreationCompleteCheck
public TimeInterval getCreationCompleteCheck()
-
setCreationCompleteCheck
public void setCreationCompleteCheck(TimeInterval t)
Specify the wait time between checking for file creation.- Parameters:
t
- the time interval; default is 500ms.
-
-