此内容没有您所选择的语言版本。
Chapter 16. Running the Camel Debugger
You can run the Camel debugger on locally running routing contexts and on remotely running routing contexts. The same basic features and functionality are available in both debugging modes.
-
Local debugging — runs the debugger on the routing context running in the same JVM with Fuse Tooling. This mode is activated by selecting the project’s routing context in the Project Explorer view and selecting
from the context menu. - Remote debugging — runs the debugger on a routing context running in a separate JVM either on the local machine or on a remote machine. This mode requires a supported runtime server installed on the local machine or on an accessible remote machine. It is activated by creating and running a debug launch configuration that specifies the remote runtime’s connection details.
If your project contains Java code, you can use the standard Eclipse Java debugging tools to debug it. For local debugging, it is automatically available. For remote debugging, you need to use the Remote Camel Context and Java launch option (see Section 16.2, “Debugging a remotely running routing context”).
You must set breakpoints in your routing context file before you can start the Camel debugger.
16.1. Debugging a locally running routing context
Procedure
- In the Project Explorer view, select the routing context file you want to debug.
Right-click the selected file to open the context menu, and then select
. Fuse Tooling builds the Camel route, starts Apache Camel, starts the routing context, enables JMX, starts the route(s) in the routing context, adds the breakpoints to the nodes, and enables the Camel debugger.
The Camel debugger suspends execution of the routing context at the first breakpoint hit (received a message), and prompts you to indicate whether you want it to open the Debug perspective.
Click Yes to open the Debug perspective.
The Debug perspective opens with the routing context suspended at the first breakpoint encountered in the running routing context.
ImportantBreakpoints are held for a maximum of five minutes, after which debugging automatically resumes, moving on to the next breakpoint or to the end of the routing context.
NoteTo see the console output, open the Console view if it was not open when you switched perspectives.
NoteBy default, the Debug perspective displays the Outline view, which provides the means to switch between separate routes in a running routing context. If your routing context contains a single route, closing the Outline view frees space to expand the other views, making it easier to access and examine debugger output.
Watching message exchanges progress through the routing context
Click (Step Over) to jump to the next node of execution in the routing context. Click (Resume) to continue execution at the next active breakpoint in the routing context.
16.2. Debugging a remotely running routing context
Prerequisites
Access to a JBoss Fuse runtime in one of the following ways:
-
Install a JBoss Fuse server on your local machine and edit its
FUSE_HOME/etc/users.properties
file to activate theadmin
user. For details, see olink:RiderUG/FIDEAddServer. -
Be able to access a JBoss Fuse server that is installed on a remote machine. You must know its connection details, including the credentials of the
admin
user.
-
Install a JBoss Fuse server on your local machine and edit its
Create a new Fuse Integration project, see olink:RiderUG/nfpProjBasics. In the Fuse Integration project:
- Select the Camel version that matches the version of the JBoss Fuse server runtime.
Create an empty Blueprint DSL project or use one of the JBoss Fuse pre-defined templates with Blueprint DSL.
NoteThough not a requirement, it is a good idea to verify that you can run the project’s routing context successfully as a
Local Camel Context
. For details, see olink:RiderUG/RiderRunningProfile.NoteThe examples in the section called “Setting up and starting remote debugging” are based on the
pre-defined template and a Red Hat JBoss Fuse 6.3.0 runtime.
In Red Hat JBoss Developer Studio:
- Add the JBoss Fuse server to the Servers view. For details, see olink:RiderUG/FIDEAddServer.
- Start the JBoss Fuse server. For details, see olink:RiderUG/FIDEStartServer.
Publish your project to the JBoss Fuse Runtime server. For details, see olink:RiderUG/autoPublish.
NoteYou cannot deploy a Fuse Integration project to a JBoss Fuse server running on a remote host from inside JBoss Developer Studio. Instead, you deploy the project’s bundle directly on the remote host using one of two supported deployment methods (for details, see ).
- Verify that the project’s bundle is deployed and active. For details, see olink:RiderUG/verifyPublished.
- Stop the JBoss Fuse Runtime server. For details, see olink:RiderUG/FIDEStopServer.
Setting up and starting remote debugging
With the project deployed on JBoss Fuse and the server stopped, you need to set up and start remote debugging as follows:
- Start JBoss Fuse in debug mode outside of JBoss Developer Studio.
- In JBoss Developer Studio, set breakpoints on nodes in the project’s routing context, which is open in the route editor.
- Create a remote Camel context debug configuration and run it.
- Connect to JBoss Fuse runtime in the JMX Navigator view.
- Drop test messages in the JMX Navigator view on the input node of the Camel route running inside the JBoss Fuse runtime.
- Use any of the Camel debugger’s tools for debugging routes.
Procedure
To set up and start remote debugging:
Open a terminal outside of JBoss Developer Studio, and enter
$ [FUSE_HOME]/bin/fuse debug
- Wait for the JBoss Fuse splash screen to appear, and then return to the Fuse Integration perspective in JBoss Developer Studio.
- In the tooling’s route editor, with the project’s routing context open in the Design tab, set breakpoints on the nodes of interest. For details, see olink:RiderUG/setBreakpoints.
In the Project Explorer view, right-click the project’s root and select menu:[Debug As > Debug Configurations] to open the Debug Configurations wizard:
In the configuration type pane, select either Remote Camel Context or Remote Camel Context and Java , and then click :
For both the Remote Camel Context and Remote Camel Context and Java options, you need to specify configuration details on the Camel and JMX tabs.
For the Remote Camel Context and Java option only, you also need to specify configuration details on the Connect tab.
NoteUnless your project contains Java code that you want to debug using the standard Eclipse Java debugging tools, select the Remote Camel Context option.
- In the field, enter a name for the new launch configuration.
On the Camel tab, click the button to locate the project’s routing context
.xml
file in the Open Resources dialog:NoteWhen you select a file in the Matching items pane, the tooling displays the file’s location, relative to the project root, at the bottom of the pane.
In the Matching items pane, select your project’s routing context file from the list, and then click .
The tooling inserts the file’s path into the Select Camel Context file field:
Click the JMX tab:
Edit the JMX connection details as follows:
JMX Uri — change
:9011/jmxrmi
to:1099/karaf-root
If the JBoss Fuse server is running on a remote host, replace
localhost
with the DNS name or IP address of the remote host.-
JMX User — enter
admin
. JMX Password — enter
admin
.ImportantThe values shown for JMX User and JMX Password are the JBoss Fuse admin user defaults, stored in the
FUSE_HOME/etc/users.properties
file. If your setup is different, enter the values specific to it.If you are creating a Remote Camel Context debug launch configuration, you are done. Skip to [debugCfgGo].
Click the Connect tab:
Change the Port value from
8000
to5005
. Leave each of the other properties as is.- Click and then click .
In the JMX Navigator view, double-click JBoss Fuse [xxx] [Disconnected] to connect to it, and then expand its tree:
In the Project Explorer view, drag a test message from
src/test/resources/data
and drop it on thecbr-example-context/Endpoints/file/work/cbr/input
folder in the JMX Navigator view.When the message hits the first breakpoint that is set in the routing context, the tooling asks you to switch to the Debug perspective:
Click Yes.
At this point, you can use any of the Camel debugger’s tools to debug your routing context.
NoteIn remote debugging sessions, the Console view does not display log output.
NoteWhen one message reaches the end of the routing context, the debugger is suspended. To continue debugging, switch back to the Fuse Integration perspective and drop another message on the input node in the JMX Navigator view. Each time you do so, the tooling asks you to confirm the switch to the Debug perspective.