- 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
- Learning Python Web Penetration Testing
- Java程序設計與開發(fā)
- UML和模式應用(原書第3版)
- Vue.js前端開發(fā)基礎與項目實戰(zhàn)
- Go語言高效編程:原理、可觀測性與優(yōu)化
- Java入門很輕松(微課超值版)
- C語言程序設計基礎與實驗指導
- Java加密與解密的藝術
- concrete5 Cookbook
- 零基礎趣學C語言
- Learning Probabilistic Graphical Models in R
- Programming with CodeIgniterMVC
- C語言程序設計教程
- Microsoft Dynamics GP 2013 Cookbook
- MySQL核心技術與最佳實踐