Overview of the ServiceMix File Binding Example
This document describes how to run ServiceMix's File Binding example and provides details about what it does. For information on the business use case, please refer to: Use Case for File Binding.
...
Info | ||
---|---|---|
| ||
The file to be transmitted from the inbox to outbox must be in XML format. |
Running the File Binding Example
From a command shell, go to the File Binding example directory:
...
Tip | ||
---|---|---|
| ||
Add $SERVICEMIX_HOME/bin directory to $PATH variable to simplify execution of the example. |
Stopping the File Binding Example
To terminate the File Binding example type "CTRL-C" in the command shell in which it is running and answer "y" to the "Terminate batch job (y/n)?" question.
How it Works
The diagram below illustrates the logical flow of the program through the file binding components.
...
Note: In the servicemix.xml
file, the "destinationService" attribute of the filePoller component is "foo:fileSender." The last line of output (above) shows the NMR using that to deliver the normalized message to fileSender.
Details
The following table provides more details about the function of each component and bean in the servicemix.xml
file.
Component or Bean ID | Description |
---|---|
filePoller | This component periodically checks the "inbox" directory looking for files. If there is a file or directory present, it adds the file to the "workingSet", which is a collection of files to be processed. The workManger is invoked to schedule the work of processing the file from the workingSet. Another thread is created and the processing of the file begins. Processing consists of marshalling the file (streaming it from disk into a normalized message). The normalized message is sent over the NMR to the fileSender component per the specified "destinationService". The destinationService is specified in the |
fileSender | This component is the "destinationService" for the filePoller. It receives normalized messages from filePoller. The messages it receives are the files that filePollerhas transferred to it via the NMR. It converts the normalized message to its original file format and sends it to the destination directory, the |
workManager | This bean is used by the filePoller to increase the throughput of the application. The workManager is a thread pool whose size can be adjusted declaratively in the |
Useful Code Hints
This section describes the start-up sequence and how the ServiceMix container interacts with the File Bindingapplication. The Java class files are located in the servicemix-1.0.1.jar file in the ServiceMix installation directory. To look at the Java source code, unjar and decompile the .class files or download the source code. Please note: the downloadable source code is slightly different than the compiled binary code.
...
Summarizing, when the ServiceMix container instantiates an MBean it firsts sets the property values if there are any, then calls the init() method of the class and its' parent classes, if applicable. Then it calls the start() method of the class. When a Spring bean starts up, the properties are set and then the afterPropertiesSet() method is called.
Related Documentation
For more information on the following topics please see:
...