官术网_书友最值得收藏!

  • Apache Karaf Cookbook
  • Achim Nierbeck Jamie Goodyear Johan Edstrom Heath Kesler
  • 365字
  • 2021-09-03 09:55:09

Listing Camel Contexts in Karaf

The installation of Apache Camel into Apache Karaf includes a set of custom Camel commands as part of the camel-karaf-commands bundle. The Camel community has developed and maintained these commands for the benefit of Karaf users, and as such have helped to fully integrate Camel into the Karaf experience. These commands are listed in the following screenshot:

As of Apache Camel 2.12.2, there are 18 Camel-Karaf commands (as shown in the previous screenshot), and in the following recipes, we'll explore the most commonly used commands.

One common task Camel users want to perform is to list all of the Camel Contexts deployed into a Karaf container.

Getting ready

The ingredients of this recipe include the Apache Karaf distribution kit, access to JDK, Maven, and a source code editor.

A sample Camel application has been developed for this recipe, and is available at https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter2/chapter2-recipe2. Building the application requires executing a Maven install and then deploying the assembled bundle into Karaf (using the install –s mvn:com.packt/sample command).

Follow the instructions in the Installing Apache Camel modules into Apache Karaf recipe to provide the base requirements to operate the sample code. We'll reuse this recipe's resources several times.

How to do it…

To list all of the Camel Contexts deployed in Karaf, execute the camel:context-list command:

karaf@root()> camel:context-list
 Context Status Uptime 
 ------- ------ ------ 
 CamelCommandContext Started 1 hour 44 minutes 
karaf@root()>

In the previous command invocation, we observe the sample Camel Router's context name displayed (in this example, the context name was set in Blueprint—see the recipe's source code for details).

How it works…

When the camel-karaf-commands bundle is installed into Karaf via the Camel feature, the Camel commands become automatically available on the Karaf console. Under the hood, the Camel command Blueprint descriptor is instantiated and the various Camel-Karaf commands are wired into the container.

When the context-list command is executed, the context IDs of each Camel Context deployed is displayed along with their current status, and if available, their uptime.

There's more…

The Apache Camel community maintains updated information on their commands, which you can find at http://camel.apache.org/karaf.html.

See also

  • The Displaying Camel Context information in Karaf recipe
主站蜘蛛池模板: 墨竹工卡县| 沙湾县| 彰武县| 石门县| 湖北省| 颍上县| 科尔| 曲阜市| 柯坪县| 阿瓦提县| 红桥区| 牙克石市| 民县| 岳西县| 九江市| 休宁县| 大足县| 咸宁市| 汨罗市| 铜鼓县| 吴江市| 英超| 满城县| 扎鲁特旗| 龙胜| 桑植县| 新乐市| 澄迈县| 天长市| 玛沁县| 永定县| 青岛市| 华容县| 合阳县| 肇东市| 古浪县| 隆回县| 康乐县| 平顺县| 高唐县| 林芝县|