The file binding in SwitchYard provides filesystem level support for services and references in SwitchYard.
The file binding is built on top of camel-file and supports most of options for this endpoint. Please refer camel documentation for detailed description of them.
Generic options
Following options can be apiled to <binding.file> definition:
-
directory : directory to consume/produce files to
-
autoCreate : automatically create directory if doesn't exist
-
bufferSize : write buffer size
-
fileName : file name filter for consumer or file name pattern for producer
-
flatten : skip path and just use file name
-
charset : charset used for reading/wrinting file
Binding Services with Files
Supported options are:
Here's an example of what a file service binding looks like:
<sca:composite name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0">
<sca:service name="GreetingService" promote="GreetingService">
<camel:binding.file>
<camel:directory>target/input</camel:directory>
<camel:fileName>test.txt</camel:fileName>
<camel:consume>
<camel:initialDelay>50</camel:initialDelay>
<camel:delete>true</camel:delete>
</camel:consume>
</camel:binding.file>
</sca:service>
</sca:composite>
Binding References with File
Binding a reference with file can be used to store outcome of service on disk. The following configuration options are available for binding.file when binding references:
-
fileExist
-
tempPrefix
-
tempFileName
-
keepLastModified
-
eagerDeleteTargetFile
-
doneFileName
For detailed description of these parameters please refer camel-file documentation
<sca:composite name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0">
<sca:reference name="GreetingService" promote="camel-binding/GreetingService" multiplicity="1..1">
<camel:binding.file>
<camel:directory>target/output</camel:directory>
<camel:autoCreate>false</camel:autoCreate>
<camel:produce>
<camel:fileExist>Override</camel:fileExist>
</camel:produce>
<camel:binding.file>
</sca:reference>
</sca:composite>