We are now going to use the Maven JBI plugin to deploy the service assembly
Deploy the SA
Using hotdeploy
Navigate into your project's SA directory and create the SA zip file.
The SA zip file is present in the target directory. To deploy the SA, simply copy the zip file into the SERVICEMIX_HOME/hotdeploy directory.
Using JBI maven plugin
Before you start, make sure that you have started ServiceMix.
Now, navigate to your project's SA directory and use the JBI Maven plugin to deploy your project.
Upon successful deployment, we get this output:
What happens here? First of all, the Maven plugin will analyze your service assembly to determine what needs to be done. In this case, it determines that the service assembly we created requires the servicemix-file JBI component, which requires the standard ServiceMix shared library. This is shown in the output from the command:
Next, the process connects to the running ServiceMix instance to determine what has already been installed/deployed. In the example below, the servicemix-file JBI component and the servicemix-shared shared library were already installed, but the service assembly still needs to be deployed. If you run the same command on a freshly installed ServiceMix instance, all dependencies will get installed/deployed automatically.
Test the service assembly
We configured our file SU to poll for files and send them to another directory. Just copy any XML file into the directory you configured in the file:poller endpoint and ServiceMix will automatically move it to the directory configured in the sender endpoint after a few seconds.
Next, we are going to start using what we have learned by adding two other SU to our SA.
Things to remember
- You can run the mvn install command to create the SA zip file and deploy it by copying the zip file into the SERVICEMIX_HOME/hotdeploy directory
- You can run the mvn jbi:projectDeploy command from the SA directory in your project
- Make sure you have ServiceMix running on the same machine before runnning this command
- The command will not only deploy the service assembly, but also install any dependencies automatically