Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titlePoller endpoint attributes
borderStylesolidbgColor='lighblue'

Name

Type

Description

Default

service

QName

the service name of the endpoint

required to be spec'd

endpoint

string

the endpoint name of the endpoint

required to be spec'd

interfaceName

QName

the interface name of the endpoint

 

targetService

QName

the service name of the target endpoint

 

targetEndpoint

string

the endpoint name of the target endpoint

 

targetInterface

QName

the interface name of the target endpoint

 

targetUri

string

the uri of the target endpoint

 

autoCreateDirectory

boolean

creates dir if doesn't exist

true

firstTime

date

datetime before first poll can take place

null (first poll right after start)

delay

long

amount of time first polling is delayed after start

0

period

long

amount of time between polls

5000

file

string

sets the file or directory to poll

null (must be spec'd)

deleteFile

boolean

delete file when it is processed

true

recursive

boolean

process sub directories

true

marshaler

class

org.apache.servicemix.components.util.FileMarshaler

DefaultFileMarshaler

lockManager

class

org.apache.servicemix.locks.LockManager

SimpleLockManager

filter

class

java.io.FileFilter (optional filter)

null - no filter

scheduler

class

org.apache.servicemix.components.varscheduler.Scheduler

new Scheduler(true)

comparator

class

implementation of java.util.Comparator<File> interface

null - no ordering

archive

string

sets the directory to archive files before deleting them
(available since 3.2)

null (no archiving)

...

In the example above it uses Apache Commons IO WildcardFilter as it implements FileFilter. The Apache Commons IO jar file must be in the classpath. See: http://commons.apache.org/io/

Comparators

You can define an implementation of the java.util.Comparator interface to specifies the process order of the files.

For example, you can process file sorted by file name. You can implement the following comparator:

Code Block
langjava
titleNameComparator

public class NameComparator implements Comparator<File> {
    
    /*
     * (non-Javadoc)
     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
     */
    public int compare(File file1, File file2) {
        return file1.getPath().compareTo(file2.getPath());
    }

}

and use it in the endpoint definition:

Code Block
langxml
titleXBean using NameComparator

<file:poller service="test:poller" endpoint="poller"
	file="file:inbox" targetService="test:service"
	targetEndpoint="endpoint" period="10000" recursive="true">
        <property name="comparator">
            <bean class="your.package.NameComparator"/>
        </property>
</file:poller>

Like this, you can process file by name, last modification date, size.

Marshalers

By default, poller endpoints expect the content of the file to be in xml format.

...