Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 10. Publishing your project to Red Hat Fuse


This tutorial walks you through the process of publishing your project to Red Hat Fuse. It assumes that you have an instance of Red Hat Fuse installed on the same machine on which you are running the Red Hat Fuse Tooling.

Goals

In this tutorial you complete the following tasks:

  • Define a Red Hat Fuse server
  • Configure the publishing options
  • Start up the Red Hat Fuse server and publish the ZooOrderApp project
  • Connect to the Red Hat Fuse server
  • Verify whether the ZooOrderApp project’s bundle was successfully built and published
  • Uninstall the ZooOrderApp project

Prerequisites

Before you start this tutorial you need:

Defining a Red Hat Fuse Server

To define a server:

  1. Open the Fuse Integration perspective.
  2. Click the Servers tab in the lower, right panel to open the Servers view.
  3. Click the No servers are available. Click this link to create a new server…​ link to open the Define a New Server page.

    Note

    To define a new server when one is already defined, right-click inside the Servers view and then select New Server.

  4. Expand the Red Hat JBoss Middleware node to expose the available server options:

    tutDefineNewServer
  5. Select a Red Hat Fuse server.
  6. Accept the defaults for Server’s host name (localhost) and Server name (Fuse n.n Runtime Server), and then click Next to open the Runtime page:

    tutFuseRuntimeDef1
    Note

    If you do not have Fuse already installed, you can download it now using the Download and install runtime link.

    If you have already defined a server, the tooling skips this page, and instead displays the configuration details page.

  7. Accept the default for Name.
  8. Click Browse next to the Home Directory field, to navigate to the installation and select it.
  9. Select the runtime JRE from the drop-down menu next to Execution Environment.

    Select JavaSE-1.8 (recommended). If necessary, click the Environments button to select it from the list.

    Note

    The Fuse server requires Java 8 (recommended). To select it for the Execution Environment, you must have previously installed it.

  10. Leave the Alternate JRE option as is.
  11. Click Next to save the runtime definition for the Fuse Server and open the Fuse server configuration details page:

    NewServerDetailsTut
  12. Accept the default for SSH Port (8101).

    The runtime uses the SSH port to connect to the server’s Karaf shell. If this default is incorrect, you can discover the correct port number by looking in the Red Hat Fuse installDir/etc/org.apache.karaf.shell.cfg file.

  13. In User Name, enter the name used to log into the server.

    This is a user name stored in the Red Hat Fuse installDir`/etc/users.properties` file.

    Note

    If the default user has been activated (uncommented) in the /etc/users.properties file, the tooling autofills User Name and Password with the default user’s name and password.

    If one has not been set, you can either add one to that file using the format user=password,role (for example, joe=secret,Administrator), or you can set one using the karaf jaas command set:

    • jaas:realms — to list the realms
    • jaas:manage --index 1 — to edit the first (server) realm
    • jaas:useradd <username> <password> — to add a user and associated password
    • jaas:roleadd <username> Administrator — to specify the new user’s role
    • jaas:update — to update the realm with the new user information

      If a jaas realm has already been selected for the server, you can discover the user name by issuing the command JBossFuse:karaf@root>jaas:users.

  14. In Password, type the password required for User name to log into the server.

    This is the password set either in Red Hat Fuse’s installDir/etc/users.properties file or by the karaf jaas commands.

  15. Click Finish.

    Runtime Server [stopped, Synchronized] appears in the Servers view.

  16. In the Servers view, expand the Runtime Server:

    JBFuseServersView

    JMX[Disconnected] appears as a node under the Runtime Server [stopped, Synchronized] entry.

Configuring the publishing options

Using publishing options, you can configure how and when your ZooOrderApp project is published to a running server:

  • Automatically, immediately upon saving changes made to the project
  • Automatically, at configured intervals after you have changed and saved the project
  • Manually, when you select a publish operation

In this tutorial, you configure immediate publishing upon saving changes to the ZooOrderApp project. To do so:

  1. In the Servers view, double-click the Runtime Server [stopped, Synchronized] entry to display its overview.
  2. On the server’s Overview page, expand the Publishing section to expose the options.

    srvEditorPubOpts

    Make sure that the option Automatically publish when resources change is enabled.

    Optionally, change the value of Publishing interval to speed up or delay publishing the project when changes have been made.

  3. In the Servers view, click Start the server .
  4. Wait a few seconds for the server to start. When it does:

    • The Terminal view displays the splash screen:

      tutServerStartShellV
    • The Servers view displays:

      tutServerStartServerV
    • The JMX Navigator displays n.n Runtime Server[Disconnected:

      tutServerStartJMXNav
  5. In the Servers view, right-click n.n Runtime Server [Started] and then select Add and Remove to open the Add and Remove page:

    tutAddRemove1

    Make sure the option If server is started, publish changes immediately is checked.

  6. Select ZooOrderApp and click Add to assign it to the Fuse server:

    tutAddRemove2
  7. Click Finish.

    The Servers view should show the following:

    tutCBRrtePublishedSrvV
    • Runtime Server [Started, Synchronized]

      Note

      For a server, synchronized means that all modules published on the server are identical to their local counterparts.

    • ZooOrderApp [Started, Synchronized]

      Note

      For a module, synchronized means that the published module is identical to its local counterpart. Because automatic publishing is enabled, changes made to the ZooOrderApp project are published in seconds (according to the value of the Publishing interval).

    • JMX[Disconnected]

Connecting to the runtime server

After you connect to the runtime server, you can see the published elements of your ZooOrderApp project and interact with them.

  1. In the Servers view, double-click JMX[Disconnected] to connect to the runtime server.
  2. In the JMX Navigator, expand the Camel folder to expose the elements of the ZooOrderApp.

    tutJMXconnected
  3. Click the Bundles node to populate the Properties view with the list of bundles installed on the runtime server:

    tutCBRrouteBundleInstall
  4. In the Search field, type ZooOrderApp. The corresponding bundle is shown:

    tutCBRrouteBundleSearch
    Note

    Alternatively, you can issue the osgi:list command in the Terminal view to see a generated list of bundles installed on the server runtime. The tooling uses a different naming scheme for OSGi bundles displayed by the osgi:list command. In this case, the command returns Camel Blueprint Quickstart, which appears at the end of the list of installed bundles.

    In the <build> section of project’s pom.xml file, you can find the bundle’s symbolic name and its bundle name (OSGi) listed in the maven-bundle-plugin entry:

    tutBundleNamesPom

Uninstalling the ZooOrderApp project

Note

You do not need to disconnect the JMX connection or stop the server to uninstall a published resource.

To remove the ZooOrderApp resource from the runtime server:

  1. In the Servers view, right-click n.n Runtime Server to open the context menu.
  2. Select Add and Remove:

    tutUnpubCBRroute
  3. In the Configured column, select ZooOrderApp, and then click Remove to move the ZooOrderApp resource to the Available column.
  4. Click Finish.
  5. In the Servers view, right-click JMX[Connected] and then click Refresh.

    The Camel tree under JMX[Connected] disappears.

    Note

    In JMX Navigator, the Camel tree under Server Connections > n.n Runtime Server[Connected] also disappears.

  6. With the Bundles page displayed in the Properties view, scroll down to the end of the list to verify that the ZooOrderApp’s bundle is no longer listed.
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.