...
Info |
---|
The streaming sample in the features section and BigBank application contains an example of using the file system binding. |
...
Service BindingsĀ
Below is an example of how to configure the binding on a service:
...
Also note that the GatewayService component can signal an invalid message by throwing an exception, in this case MessageException. If an exception is thrown, the file system binding will by default move the file to the error directory.
Service Adapter Components
Sometimes special processing may need to be performed prior to passing a file to the bound service. A special adapter component that implements the org.fabric3.binding.file.api.ServiceAdapter interface can be specified:
...
<import.java package="org.fabric3.binding.file.api" version="..."/>
Reference
...
Bindings
A reference can be bound to the file system binding. This can be used to send messages or return responses to a client. Below is an example of how to configure the binding on a reference:
...
The interface must have one operation that takes a String parameter (used to create the file name for the message) and returns an OutputStream.
Reference Adapter Components
An adapter can also be configured for a reference bound to the file system binding. In this case, the adapter must implement org.fabric3.binding.file.api.ReferenceAdapter. The binding configuration is identical:
...
<import.java package="org.fabric3.binding.file.api" version="..."/>
Configuring the Archive Strategy
By default, the file system binding delete a message file once it has been processed. If the message should instead be archived, this can be done by specifying the archive strategy and an archive directory on the binding configuration:
Code Block | ||||
---|---|---|---|---|
| ||||
<component name="GatewayComponent"> <implementation.java class="..."/> <service name="GatewayService"> <f3:binding.file ... strategy="archive" archive.location="archive.directory"/> </service> </component> |
Cluster Setup
Often, the file system binding will be used in a cluster setup. When this is the case, the binding inbox and outbox must be mapped to shared filesystem directories (these could be on a SAN to provide high-availability and guaranteed message delivery). Also note that when deployed to a cluster, the file system binding creates file locks to avoid more than one instances simultaneously processing a file.