public class FileMessageReceiver extends AbstractPollingMessageReceiver
FileMessageReceiver
is a polling listener that reads files from a
directory.Modifier and Type | Field and Description |
---|---|
static String |
COMPARATOR_CLASS_NAME_PROPERTY |
static String |
COMPARATOR_REVERSE_ORDER_PROPERTY |
static String |
MULE_TRANSPORT_FILE_SINGLEPOLLINSTANCE |
DEFAULT_POLL_FREQUENCY, DEFAULT_POLL_TIMEUNIT, DEFAULT_STARTUP_DELAY, schedules
defaultInboundTransformers, defaultResponseTransformers, flowConstruct, listener, receiverKey, replyToHandler
connected, connector, defaultMessageInfoMapping, endpoint, lifecycleManager, logger, muleMessageFactory, retryTemplate
PHASE_NAME
PHASE_NAME
PHASE_NAME
PHASE_NAME
Constructor and Description |
---|
FileMessageReceiver(Connector connector,
FlowConstruct flowConstruct,
InboundEndpoint endpoint,
String readDir,
String moveDir,
String moveToPattern,
long frequency) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
attemptFileLock(File sourceFile)
Try to acquire a lock on a file and release it immediately.
|
protected void |
basicListFiles(File currentDirectory,
List<File> discoveredFiles) |
protected void |
checkMustForceSync()
If we will be autodeleting File objects, events must be processed synchronously to avoid a race
|
protected org.mule.transport.file.ReceiverFileInputStream |
createReceiverFileInputStream(File sourceFile,
File destinationFile) |
protected org.mule.transport.file.ReceiverFileInputStream |
createReceiverFileInputStream(File sourceFile,
File destinationFile,
InputStreamCloseListener closeListener) |
protected void |
doConnect() |
protected void |
doDisconnect() |
protected void |
doDispose() |
protected void |
doInitialise() |
protected Comparator<File> |
getComparator() |
protected boolean |
isAgedFile(File file,
long fileAge)
Indicates whether or not file is older than the specified age
|
void |
poll() |
protected boolean |
pollOnPrimaryInstanceOnly()
If this returns true for a transport, polling for that transport takes place only on the primary instance.
|
void |
processFile(File file) |
protected void |
rollbackFileMove(File sourceFile,
String destinationFilePath)
Exception tolerant roll back method
|
createWork, disableNativeScheduling, doStart, doStop, getBatchSize, getFrequency, getTimeUnit, performPoll, schedule, setFrequency, setTimeUnit, unschedule
applyInboundTransformers, applyResponseTransformers, connectHandler, createExecutionTemplate, createLifecycleManager, createMuleEvent, doStartHandler, getConnectEventId, getConnectionDescription, getEndpoint, getEndpointURI, getFlowConstruct, getReceiverKey, getReplyToHandler, getWorkManager, handleUnacceptedFilter, initialise, processMessage, propagateRootMessageIdProperty, routeEvent, routeMessage, routeMessage, routeMessage, routeMessage, routeMessage, setEndpoint, setListener, setReceiverKey, shouldConsumeInEveryNode, toString, warnIfMuleClientSendUsed
activate, connect, createMuleMessage, createMuleMessage, createMuleMessage, createMuleMessageFactory, createNullMuleMessage, disconnect, dispose, disposeAndLogException, getConnectEventId, getConnector, getLifecycleState, initializeMessageFactory, initializeRetryPolicy, isConnected, isDoThreading, isStarted, isStarting, isStopped, isStopping, passivate, setEndpoint, start, stop, validate, validateConnection
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createMuleMessage, createMuleMessage
connect, disconnect, isConnected, validateConnection
dispose
public static final String COMPARATOR_CLASS_NAME_PROPERTY
public static final String COMPARATOR_REVERSE_ORDER_PROPERTY
public static final String MULE_TRANSPORT_FILE_SINGLEPOLLINSTANCE
public FileMessageReceiver(Connector connector, FlowConstruct flowConstruct, InboundEndpoint endpoint, String readDir, String moveDir, String moveToPattern, long frequency) throws CreateException
CreateException
protected void checkMustForceSync() throws CreateException
CreateException
protected void doInitialise() throws InitialisationException
doInitialise
in class AbstractTransportMessageHandler
InitialisationException
protected void doConnect() throws Exception
doConnect
in class AbstractTransportMessageHandler
Exception
protected void doDisconnect() throws Exception
doDisconnect
in class AbstractTransportMessageHandler
Exception
protected void doDispose()
doDispose
in class AbstractMessageReceiver
public void poll()
poll
in class AbstractPollingMessageReceiver
protected boolean pollOnPrimaryInstanceOnly()
AbstractPollingMessageReceiver
pollOnPrimaryInstanceOnly
in class AbstractPollingMessageReceiver
public void processFile(File file) throws MuleException
MuleException
protected boolean isAgedFile(File file, long fileAge)
file
- file to checkfileAge
- target file age in millisecondsprotected org.mule.transport.file.ReceiverFileInputStream createReceiverFileInputStream(File sourceFile, File destinationFile) throws FileNotFoundException
FileNotFoundException
protected org.mule.transport.file.ReceiverFileInputStream createReceiverFileInputStream(File sourceFile, File destinationFile, InputStreamCloseListener closeListener) throws FileNotFoundException
FileNotFoundException
protected boolean attemptFileLock(File sourceFile) throws MuleException
sourceFile
- file to checktrue
if the file can be lockedMuleException
protected void rollbackFileMove(File sourceFile, String destinationFilePath) throws IOException
Throwable
IOException
protected Comparator<File> getComparator() throws Exception
Exception
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.