此内容没有您所选择的语言版本。

10.3. Working with runtime profiles


Red Hat JBoss Fuse Tooling stores information about the runtime environments for each project in runtime profiles. The runtime profiles keep track of such information as which Maven goals to call, the Java runtime environment to use, any system variables that need to be set, and so on. A project can have more than one runtime profile.

10.3.1. Editing a Local Camel Context runtime profile

Overview

A Local Camel Context runtime profile configures how Apache Camel is invoked to execute a route. A Local Camel Context runtime profile stores the name of the context file in which your routes are defined, the name of the main to invoke, the command line options passed into the JVM, the JRE to use, the classpath to use, any environment variables that need to be set, and a few other pieces of information.
The runtime configuration editor for a Local Camel Context runtime profile contains the following tabs:
  • Camel Context File—specifies the name of the new configuration and the full path of the routing context file that contains your routes.
  • Main—specifies the fully qualified name of the project's base directory, a few options for locating the base directory, any goals required to execute before running the route, and the version of the Maven runtime to use.
  • JRE—specifies the JRE and command line arguments to use when starting the JVM.
  • Refresh—specifies how Maven refreshes the project's resource files after a run terminates.
  • Environment—specifies any environment variables that need to be set.
  • Common—specifies how the profile is stored and the output displayed.
The first time an Apache Camel route is run as a Local Camel Context, Red Hat JBoss Fuse Tooling creates for the routing context file a default runtime profile, which should not require editing.

Accessing the Local Camel Context's runtime configuration editor

  1. In Project Explorer, select the camelContext file for which you want to edit or create a custom runtime profile.
  2. Right-click it to open the context menu, and then select Run As... Run Configurations to open the Run Configurations dialog.
  3. In the context selection pane, select Local Camel Context, and then click New profile icon at the top, left of the context selection pane.
  4. In the Name field, enter a new name for your runtime profile.

Figure 10.1. Runtime configuration editor for Local Camel Context

Local camel context runtime configuration editor

Setting the camel context file

The Camel Context File tab has one field, Select Camel Context file.... Enter the full path to the routing context file that contains your route definitions.
The Browse... button accesses the Open Resource dialog, which facilitates locating the target routing context file. This dialog is preconfigured to search for files that contain Apache Camel routes.

Changing the command line options

By default the only command line option passed to the JVM is:
-fa context-file
If you are using a custom main class you may need to pass in different options. To do so, on the Main tab, click the Add button to enter a parameter's name and value. You can click the Add Parameter dialog's Variables... button to display a list of variables that you can select.
To add or modify JVM-specific arguments, edit the VM arguments field on the JRE tab.

Changing where output is sent

By default, the output generated from running the route is sent to the Console view. But you can redirect it to a file instead.
To redirect output to a file:
  1. Select the Common tab.
  2. In the Standard Input and Output pane, click the checkbox next to the File: field, and then enter the path to the file where you want to send the output.
    The Workspace..., File System..., and Variables... buttons facilitate building the path to the output file.

Related topics

Section 10.1, “Running routes as a local Camel context”

10.3.2. Editing a Maven runtime profile

Overview

A Maven runtime profile configures how Maven invokes Apache Camel. A Maven runtime profile stores the Maven goals to execute, any Maven profiles to use, the version of Maven to use, the JRE to use, the classpath to use, any environment variables that need to be set, and a few other pieces of information.
The runtime configuration editor for a Fuse runtime profile contains the following tabs:
  • Main—specifies the name of the new configuration, the fully qualified name of the project's base directory, a few options for locating the base directory, any goals required to execute before running the route, and the version of the Maven runtime to use.
  • JRE—specifies the JRE and command line arguments to use when starting the JVM.
  • Refresh—specifies how Maven refreshes the project's resource files after a run terminates.
  • Environment—specifies any environment variables that need to be set.
  • Common—specifies how the profile is stored and the output displayed.
The first time an Apache Camel route is run using Maven, you must create a default runtime profile for it.

Accessing the Maven runtime configuration editor

  1. In Project Explorer, select the root of the project for which you want to edit or create a custom runtime profile.
  2. Right-click it to open the context menu, and then select Run As... Run Configurations to open the Run Configurations dialog.
  3. In the context selection pane, select m2 Maven Build, and then click New profile icon at the top, left of the context selection pane.

Figure 10.2. Runtime configuration editor for Maven

Maven runtime configuration editor

Changing the Maven goal

The most commonly used goal when running a route is camel:run. It loads the routes into a Spring container running in its own JVM.
The Apache Camel plug-in also supports a camel:embedded goal that loads the Spring container into the same JVM used by Maven. The advantage of this is that the routes should bootstrap faster.
If your POM contains other goals, you can change the Maven goal used by clicking the Configure... button next to the Maven Runtime field on the Main tab. On the Installations dialog, you edit the Global settings for <selected_runtime> installation field.

Changing the version of Maven

By default, Red Hat JBoss Fuse Tooling for Eclipse uses m2e, which is embedded in Eclipse. If you want to use a different version of Maven or have a newer version installed on your development machine, you can select it from the Maven Runtime drop-down menu on the Main tab.

Changing where the output is sent

By default, the output from the route execution is sent to the Console view. But you can redirect it to a file instead.
To redirect output to a file:
  1. Select the Common tab.
  2. Click the checkbox next to the File: field, and then enter the path to the file where you want to send the output.
    The Workspace..., File System..., and Variables... buttons facilitate building the path to the output file.

Related topics

Section 10.2, “Running routes using Maven”
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.