JBI Support deprecated in Apache ServiceMix 4

JBI 1.0 support is available in Apache ServiceMix 4 to allow existing users to migrate more easily to this latest version - if you're a new user, you should consider JBI deprecated and not use it for your project. Take a look at our technology selection guidelines for more information.

servicemix-file

Overview

The ServiceMix File component provides JBI integration to the file system. It can be used to read & write files via URI or to periodically poll directories for new files.

Namespace and xbean.xml

The namespace URI for the servicemix-bean JBI component is http://servicemix.apache.org/file/1.0. This is an example of an xbean.xml file with a namespace definition with prefix bean.

<beans xmlns:file="http://servicemix.apache.org/file/1.0">

  <!-- add file:poller and file:sender definitions here -->

</beans>

Endpoint types

The servicemix-file component defines two endpoint type:

  • file:poller :: Periodically polls a directory for files and sends an exchange for every file

  • file:sender :: Writes the contents of an exchange to a file

file:poller

Endpoint properties

Property Name Type Description
archive java.io.File Specifies a directory relative to the polling directory to which processed files are archived.
autoCreateDirectory boolean Specifies if the endpoint should create the target directory, if it does not already exist. If you set this to <code>false</code> and the directory does not exist, the endpoint will not do anything. Default value is <code>true</code>.
comparator java.util.Comparator Specifies a <code>Comparator</code> which will be used to sort File listing before starting to process. The default is null, means no sorting. <code>Comparator</code> objects are implementations of <code>java.util.Comparator</code>.
component org.apache.servicemix.common.DefaultComponent
concurrentPolling boolean <p> Sets whether more than one poll can be active at a time (true means yes). Default value is <code>false</code>. </p>
delay long <p> Sets the amount of time in milliseconds that the endpoint should wait before making the first poll. </p>
deleteFile boolean Specifies if files should be deleted after they are processed. Default value is <code>true</code>.
endpoint java.lang.String <p> Get the endpoint implementation. </p>
file java.io.File Specifies the file or directory to be polled. If it is a directory, all files in the directory or its sub-directories will be processed by the endpoint. If it is a file, only files matching the filename will be processed."
filter java.io.FileFilter Bean defining the class implementing the file filtering strategy. This bean must be an implementation of the <code>java.io.FileFilter</code> interface.
firstTime java.util.Date <p> Sets the date on which the first poll will be executed. If a delay is also set using <code>setDelay</code>, the delay interval will be added after the date specified. </p>
interfaceName javax.xml.namespace.QName <p> Get the qualified name of the endpoint interface. </p>
lockManager org.apache.servicemix.common.locks.LockManager Bean defining the class implementing the file locking strategy. This bean must be an implementation of the <code>org.apache.servicemix.locks.LockManager</code> interface. By default, this will be set to an instances of <code>org.apache.servicemix.common.locks.impl.SimpleLockManager</code>.
marshaler org.apache.servicemix.components.util.FileMarshaler Specifies a <code>FileMarshaler</code> object that will marshal file data into the NMR. The default file marshaller can read valid XML data. <code>FileMarshaler</code> objects are implementations of <code>org.apache.servicemix.components.util.FileMarshaler</code>.
maxConcurrent int How many open exchanges can be pending. Default is -1 for unbounded pending exchanges. Set to 1...n to engage throttling of polled file processing.
period long <p> Sets the number of milliseconds between polling attempts. </p>
recursive boolean Specifies if sub-directories are polled; if false then the poller will only poll the specified directory. If the endpoint is configured to poll for a specific file rather than a directory then this attribute is ignored. Default is <code>true</code>.
scheduler org.apache.servicemix.common.scheduler.Scheduler <p> Sets a custom scheduler implementation if you need more fine-grained control over the polling schedule. </p>
service javax.xml.namespace.QName <p> Get the service qualified name of the endpoint. </p>
serviceUnit org.apache.servicemix.common.ServiceUnit
targetEndpoint java.lang.String the name of the endpoint to which requests are sent
targetInterface javax.xml.namespace.QName the QName of the interface to which requests are sent
targetOperation javax.xml.namespace.QName the QName of the operation to which requests are sent
targetService javax.xml.namespace.QName the QName of the service to which requests are sent
targetUri java.lang.String <p> Gets the target URI of the consumer endpoint. </p>

file:sender

Endpoint properties

Property Name Type Description
append boolean Specifies if the endpoint appends data to existing files or if it will overwrite existing files. The default is for the endpoint to overwrite existing files. Setting this to <code>true</code> instructs the endpoint to append data. Default value is <code>false</code>.
autoCreateDirectory boolean Specifies if the endpoint should create the target directory if it does not exist. If you set this to <code>false</code> and the directory does not exist, the endpoint will not do anything. Default value: <code>true</code>.
component org.apache.servicemix.file.FileComponent
directory java.io.File Specifies the directory where the endpoint writes files.
endpoint java.lang.String <p> Get the endpoint implementation. </p>
interfaceName javax.xml.namespace.QName <p> Get the qualified name of the endpoint interface. </p>
marshaler org.apache.servicemix.components.util.FileMarshaler Specifies a <code>FileMarshaler</code> object that will marshal message data from the NMR into a file. The default file marshaler can write valid XML data. <code>FileMarshaler</code> objects are implementations of <code>org.apache.servicemix.components.util.FileMarshaler</code>.
overwrite boolean Specifies if the endpoint overwrites existing files or not. The default is for the endpoint to not overwrite existing files. Setting this to <code>true</code> instructs the endpoint to overwrite existing files. Default value is <code>false</code>.
service javax.xml.namespace.QName <p> Get the service qualified name of the endpoint. </p>
tempFilePrefix java.lang.String Specifies a string to prefix to the beginning of generated file names.
tempFileSuffix java.lang.String Specifies a string to append to generated file names.