Chapter 23. Deploying an Application

Abstract

Red Hat JBoss Fuse will automatically install and deploy your application. You can also manually control the state of your application using the console.

Overview

There are two ways to deploy your application into Red Hat JBoss Fuse:
  1. Rely on the hot deployment mechanism.
  2. Use the console.
You can also start and stop a deployed application using the console.

Hot deployment

The easiest way to deploy an application is to place it in the hot deployment folder. By default, the hot deployment folder is InstallDir/deploy. Any bundle placed in this folder is installed into the container. If its dependencies can be resolved, the bundle is activated.
One the bundle is installed in the container, you can manage it using the console.

Deploying from the console

The easiest way to deploy an application from the console is to install it and start it in one step. This is done using the osgi install -s command. It takes the location of the bundle as a URI. So the command:
servicemix>osgi install -s file:/home/finn/ws/widgetapp.jar
Installs and attempts to start the bundle widgetapp.jar which is located in /home/finn/ws.
You can use the osgi install command without the -s flag. That will install the bundle without attempting to start it. You will then have to manually start the bundle using the osgi start command.
The osgi start command uses the bundle ID to determine which bundle to activate.
Note
You can get a list of the bundle IDs using the osgi list command.

Refreshing an application

If you make changes to your application and want to redeploy it, you can do so by replacing the installed bundle with a new version and using the osgi refresh command. This command instructs the container to stop the running instance of your application, reload the bundle, and restart it.
The osgi refresh command uses a bundle ID to determine which bundle to refresh.

Stopping an application

If you want to temporarily deactivate your application you can use the osgi stop command. The osgi stop moves your application's bundle from the active state to the resolved state. This means that it can be easily restarted using the osgi start command.
The osgi stop command uses a bundle ID to determine which bundle to stop.

Uninstalling an application

When you want to permanently remove an application from the container you need to uninstall it. Bundles can only be installed when they are not active. This means that you have to stop your application using the osgi stop command before trying to unistall it.
Once the application's bundle is stopped, you can use the osgi uninstall command to remove the bundle from the container. This does not delete the physical bundle. It just removes the bundle from the container's list of installed bundles.
The osgi stop command uses a bundle ID to determine which bundle to unistall.