Chapter 3. Getting started with Fuse on JBoss EAP

This chapter introduces Fuse on JBoss EAP, and explains how to install, develop, and build your first Fuse application on a JBoss EAP container.

See the following topics for details:

3.1. About Fuse on JBoss EAP

JBoss Enterprise Application Platform (EAP), based on Jakarta EE technology (previously, Java EE) from the Eclipse Foundation, was originally created to address use cases for developing enterprise applications. JBoss EAP is characterized by well-defined patterns for implementing services and standardized Java APIs (for example, for persistence, messaging, security, and so on). In recent years, this technology has evolved to be more lightweight, with the introduction of CDI for dependency injection and simplified annotations for enterprise Java beans.

Distinctive features of this container technology are:

  • Particularly suited to running in standalone mode.
  • Many standard services (for example, persistence, messaging, security, and so on) pre-configured and provided out-of the-box.
  • Application WARs typically small and lightweight (because many dependencies are pre-installed in the container).
  • Standardized, backward-compatible Java APIs.

3.2. Installing Fuse on JBoss EAP

The standard installation package for Fuse 7.4 on JBoss EAP is available for download from the Red Hat Customer Portal. It installs the standard assembly of the JBoss EAP container, and provides the full Fuse technology stack.

Prerequisites

Procedure

  1. Run the JBoss EAP installer from a shell prompt, as follows:

    java -jar DOWNLOAD_LOCATION/jboss-eap-7.2.0-installer.jar
  2. During installation:

    1. Accept the terms and conditions.
    2. Choose your preferred installation path, EAP_INSTALL, for the JBoss EAP runtime.
    3. Create an administrative user and make a careful note of these administrative user credentials for later.
    4. You can accept the default settings on the remaining screens.
  3. Open a shell prompt and change directory to EAP_INSTALL.
  4. From the EAP_INSTALL directory, apply JBoss EAP 7.2 Update 01. For example:

    bin/jboss-cli.sh "patch apply jboss-eap-7.2.1-patch.zip"
  5. From the EAP_INSTALL directory, run the Fuse on EAP installer, as follows:

    java -jar DOWNLOAD_LOCATION/fuse-eap-installer-7.4.0.jar
  6. Run the CodeReady Studio installer, as follows:

    java -jar DOWNLOAD_LOCATION/codereadystudio-12.12.0.GA-installer-standalone.jar
  7. During installation:

    1. Accept the terms and conditions.
    2. Choose your preferred installation path.
    3. Select the Java 8 JVM.
    4. At the Select Platforms and Servers step, configure the JBoss EAP runtime by clicking Add and browsing to the location of the EAP_INSTALL directory.
    5. At the Select Additional Features to Install step, select Red Hat Fuse Tooling.
  8. CodeReady Studio starts up. When the Searching for runtimes dialog appears, click OK to create the JBoss EAP runtime.
  9. (Optional) In order to use Apache Maven from the command line, you need to install and configure Maven.

    Note

    If you are using CodeReady Studio exclusively, it is not strictly necessary to install Maven, because CodeReady Studio has Maven pre-installed and configured. However, if you plan to invoke Maven from the command line, you must perform this step.

3.3. Building your first Fuse application on JBoss EAP

This set of instructions assists you in building your first Fuse application on JBoss EAP.

Prerequisites

Procedure

  1. In CodeReady Studio, create a new project, as follows:

    1. Select File→New→Fuse Integration Project.
    2. In the Project Name field, enter eap-camel.
    3. Click Next.
    4. In the Select a Target Environment pane, choose the following settings:

      • Select Standalone as the deployment platform.
      • Select Wildfly/Fuse on EAP as the runtime environment and use the Runtime (optional) dropdown menu to select the JBoss EAP 7.x Runtime server as the target runtime.
    5. After selecting the target runtime, the Camel Version is automatically selected for you and the field is grayed out.
    6. Click Next.
    7. In the Advanced Project Setup pane, select the Spring Bean - Spring DSL template.
    8. Click Finish.

      Important

      If this is the first time you are building a Fuse project in CodeReady Studio, it will take several minutes for the wizard to finish generating the project. This is because it downloads dependencies from remote Maven repositories. Do not interrupt the wizard or close CodeReady Studio while the project is building in the background.

    9. If prompted to open the associated Fuse Integration perspective, click Yes.
    10. Wait while CodeReady Studio downloads required artifacts and builds the project in the background.
  2. Deploy the project to the server, as follows:

    1. In the Servers view (bottom left corner of the Fuse Integration perspective), if the server is not already started, select the Red Hat JBoss EAP 7.2 Runtime server and click the green arrow to start it.
    2. Wait until you see a message like the following in the Console view:

      14:47:07,283 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.2.0.GA (WildFly Core 6.0.11.Final-redhat-00001) started in 13948ms - Started 495 of 680 services (326 services are lazy, passive or on-demand)
    3. After the server has started, switch back to the Servers view, right-click the server and select Add and Remove from the context menu.
    4. In the Add and Remove dialog, select the eap-camel project and click Add >.
    5. Click Finish.
  3. Verify that the project is working, as follows:

    1. Browse to the following URL to access the service running in the eap-camel project: http://localhost:8080/camel-test-spring?name=Kermit
    2. The browser window should show the response Hello Kermit.
  4. Undeploy the project, as follows:

    1. In the Servers view, select the Red Hat JBoss EAP 7.2 Runtime server.
    2. Right-click the server and select Add and Remove from the context menu.
    3. In the Add and Remove dialog, select your eap-camel project and click < Remove.
    4. Click Finish.