Red Hat Training

A Red Hat training course is available for Red Hat Fuse

Chapter 7. To Deploy a Camel Project to a fabric profile

Abstract

This tutorial walks you through the process of deploying a camel project into a fabric profile in Fuse Integration perspective. It assumes that you have an instance of Red Hat JBoss Fuse installed on the same machine on which you are running the Red Hat JBoss Fuse Tooling.

Goals

In this tutorial you will:
  • create a fabric in JBoss Fuse 6.x Server
  • connect to the JBoss Fuse 6.x Server
  • connect to the fabric
  • create a new fabric profile
  • deploy your project to the new fabric profile

Prerequisites

To complete this tutorial you will need:

Creating a fabric in Red Hat JBoss Fuse

To create a fabric in Red Hat JBoss Fuse:
  1. Open a terminal and cd to the JBoss Fuse server's installDir.
  2. Enter ./bin/fuse to start up a standalone instance of jboss-fuse-6.x.x.redhat-xxx.
    Wait a few seconds for the JBoss Fuse 6.x server to start up.
  3. At the JBoss Fuse console command line, enter fabric:create and press Enter to create a fabric.
    JBossFuse:karaf@root> fabric:create
    Waiting for container: root
    Using specified zookeeper password:admin
    It may take a couple of seconds for the container to provision...
    You can use the --wait-for-provisioning option, if you want this command to block until the container is provisioned.
    JBossFuse:karaf@root>
    You can use the fabric:status command to check whether the fabric has been created and provisioned.
    JBossFuse:karaf@root> fabric:status
    [profile]                                [instances]    [health]
    fabric                                   1              100%
    fabric-ensemble-0000-1                   1              100%
    jboss-fuse-full                          1              100%
    JBossFuse:karaf@root>
  4. Once the fabric is running, enter fabric:container-list and press Enter to list the new fabric's default container (root*) and its status.
    JBossFuse:karaf@root> fabric:container-list
    [id]  [version]  [alive]  [profiles]                                     [provision status]
    root*  1.0        true    fabric,fabric-ensemble-0000-1,jboss-fuse-full   success
    JBossFuse:karaf@root>

Connecting to the JBoss Fuse server

To connect the Fuse Tooling to the JBoss Fuse server:
  1. If necessary, reopen Fuse Integration perspective.
  2. In Fabric Explorer, right-click Fabrics to open the context menu, and then click Add Fabric details to open the Fabric Details wizard.

    Figure 7.1. Fabric Details wizard

    Add fabric details
  3. In Name, enter the name of the fabric to which you want to connect. The name you enter identifies the fabric whose location you specify in Jolokia URL, and this name will appear in Fabric Explorer.
    The default Name is Local Fabric.
  4. In Jolokia URL, enter the url, in the form http://hostname:port/jolokia/, of the fabric to which you want to connect. This URL specifies the location of a fabric registry agent, whose default port is 8181.
    The default URL is http://localhost:8181/jolokia.
  5. In User name, enter the name used to log into the specified fabric.
    This is the user name specified when the fabric was created, has admin privileges, and is stored in Red Hat JBoss Fuse's installDir/etc/users.properties file. In that file, user information is specified using this format: user=password,role (for example, admin=admin,admin).
    You can also discover the user name by issuing the command JBossFuse:karaf@root>jaas:users, if the Jaas realm has been selected for the fabric.
  6. In Password, enter the password required for User name to log into the specified fabric.
    This is the password specified for User name when the fabric was created and is stored in Red Hat JBoss Fuse's installDir/etc/users.properties file.
  7. In Zookeeper Password, enter the password required for logging into the specified fabric's zookeeper registry.
    This is the password that was specified when the fabric was created, or it is the password of the first user defined in Red Hat JBoss Fuse's installDir/etc/users.properties file.
    You can also discover the Zookeeper password by issuing the command JBossFuse:karaf@root>fabric:ensemble-password.
  8. Click OK.
    The fabric's name appears in Fabric Explorer as a node beneath Fabrics.

Connecting to the fabric

In Fabric Explorer, right-click Local Fabric to open the context menu, and then click Connect to connect to the new fabric.
Now you're ready to create a new fabric profile into which you'll deploy your camel project.

Creating a new fabric profile

To create a new fabric profile:
  1. In Fabric Explorer, expand Local FabricVersions1.0 to reveal the fabric's top-level profiles.
  2. Further expand the profiles tree to find the example-quickstarts-jms profile nested under default/karaf/feature-camel/feature-camel-jms/.
  3. Right-click example-quickstarts-jms to open the context menu, and then click Create a new Profile.
  4. In Profile name, enter myCamelRoute, and then click OK.
    The new profile myCamelRoute appears under its parent profile, example-quickstarts-jms, in Fabric Explorer.
  5. Click the myCamelRoute profile to populate the Details tab's Profiles page with its information.
  6. In the Parents pane, you can see that example-quickstarts-jms is the new profile's immediate parent. Leave example-quickstarts-jms selected.
    Now you're ready to deploy your camel project to the profile myCamelRoute.

Deploying your camel project to the new fabric profile

To deploy your camel project to the new myCamelRoute fabric profile:
  1. From Project Explorer, drag the simple-route root project over to Fabric Explorer and drop it on Local FabricVersions1.0defaultkaraffeature-camelfeature-camel-jmsexample-quickstarts-jmsmyCamelRoute.
    Note
    The Deploy to... tool provides an alternative to the drag and drop method of deployment. For details, see Deploying a Project to a Fabric Container in Red Hat JBoss Fuse Tooling: JBoss Fuse Tooling User Guide.
    Console view chronicles the process as the tooling builds the simple-route project, runs the tests, installs the project as a bundle in the myCamelRoute profile, and then uploads the profile to the fabric's internal Maven repository.
  2. In Fabric Explorer, click the myCamelRoute profile to populate Properties view with its properties and profile information.
    Note
    It can take some time for the tooling to build the project, run the tests, and install the project bundle. The simple-route bundle will appear in the FABs field on the Profiles page only when the process has finished. You can use Fabric Explorer's Refresh button to trigger an update of the Profiles page.
  3. On the Profiles page, check that the simple-route bundle appears in the FABs field, as shown in Figure 7.2, “simple-route bundle deployed”.

    Figure 7.2. simple-route bundle deployed

    camel project deployed to profile
    Now you can deploy your camel project to the fabric by creating one or more containers on the fabric and assigning the myCamelRoute profile to them. Once the containers are started, you can start tracing on the deployed projects, as described in Chapter 4, To Trace a Message Through a Route.

Further reading

To learn more about deploying applications to a fabric, see in Deploying a Project to a Fabric Container in Red Hat JBoss Fuse: Tooling User Guide on the Red Hat Customer Portal:
  • Deploying Projects to a Container
  • Working with Fabric Containers
  • Working with Fabric Profiles
  • Working with Versions