Versions Compared

Key

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

...

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.

Maven Archetype

...

Poller Service Unit Archetype

The servicemix-file-poller-service-unit archetype creates a File Poller Service Unit:

Code Block
mvn archetype:create \
  -DarchetypeGroupId=org.apache.servicemix.tooling \
  -DarchetypeArtifactId=servicemix-file-poller-service-unit \
  -DarchetypeVersion=2010.01 \
  -DgroupId=your.group.id \
  -DartifactId=your.artifact.id \
  -Dversion=your-version

Sender Service Unit Archetype

The servicemix-file-sender-service-unit archetype creates a File Sender Service Unit:

Code Block
mvn archetype:create \
  -DarchetypeGroupId=org.apache.servicemix.tooling \
  -DarchetypeArtifactId=servicemix-file-sender-service-unit \
  -DarchetypeVersion=2010.01 \
  -DgroupId=your.group.id \
  -DartifactId=your.artifact.id \
  -Dversion=your-version

Endpoints Configuration

...

langxml
titleProvider endpoint

...

Poller Endpoint

Code Block
langxml
titlePolling (consumer) endpoint
<file:poller service="test:poller"
             endpoint="poller"
             targetService="test:receiver"
             file="file:target/pollerFiles" />

Poller generates an InOnly message.

Info
titlePoller endpoint attributesEndpoint 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)

 
 

Sender Endpoint

Code Block
langxml
titleProvider endpoint

<file:sender service="test:service"
             endpoint="endpoint"
             directory="file:target/pollerFiles" />
Info
titleSender endpoint attributesEndpoint 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

directory

file

 

required to be spec'd

autoCreateDirectory

boolean

 

true

append

boolean

append to an existing file instead of overwriting it (3.3 or above)

false

marshaler

class

org.apache.servicemix.components.util.FileMarshaler

DefaultFileMarshaler

tempFilePrefix

string

 

"servicemix-"

tempFileSuffix

string

 

".xml"

...

URI

You can use the familiar file URI to communicate with files

...