此内容没有您所选择的语言版本。
Chapter 14. Setting Breakpoints
Overview
You can set breakpoints in either JBoss perspective or in Fuse Integration perspective, but JBoss perspective provides more room for expanding the route editor's canvas when building and modifying routes. To set breakpoints, your project's routing context
.xml
file must be open in the route editor's Design View.
The Camel debugger supports two types of breakpoints:
- Unconditional breakpoints—triggered whenever one is encountered during a debugging session
- Conditional breakpoints—triggered only when the breakpoint's specified condition is met during a debugging session
Note
You cannot set breakpoints on Consumer endpoints or on When or Otherwise nodes.
Note
The Camel debugger requires the
camelContext
element and each node for which a breakpoint is set to have a unique ID. You can set IDs manually in a node's Properties editor or directly in the CamelContext file in Source view, or you can let Fuse Tooling generate and apply them automatically. The Please confirm... dialog opens whenever you set a breakpoint on a node that does not already have a unique ID.
Important
Make sure you save any changes you make to your routing context file before you run the Camel debugger on it. Otherwise, your changes will not be included in the debugging session.
Setting unconditional breakpoints
With your routing context displayed on the canvas in Design View:
- Select a node whose state you want to examine during the debugging session.
- Click its icon to set an unconditional breakpoint.
- In the Please Confirm... dialog, click OK to have the Route Editor automatically generate and apply a unique ID to the <camelContext> element and to the node or nodes that need it, or click Cancel if you want to manually enter unique IDs in the <camelContext> element and to each node that needs one.
- Repeat these steps for each node on which you want to set an unconditional breakpoint.
Setting conditional breakpoints
With your routing context displayed on the canvas in Design View:
- Select a node whose state you want to examine during the debugging session.
- Click its icon to set a conditional breakpoint and open the Edit the condition and language of your breakpoint... dialog.
- Click the Language drop-down menu and select the expression langauge to use to create the condition that will trigger the breakpoint.Fuse Tooling supports twenty expression languages from which to choose. Except for
constant
,method
,property
, andref
, each of these languages provides variables for creating conditional expressions. - Click the Variables drop-down menu and select in sequence one or more of the language's supported variables to create the condition for triggering the breakpoint. The variables you select appear in the Condition text box.Alternatively, you can manually enter the expression directly into the Condition text box.
Disabling breakpoints
You can temporarily disable a breakpoint, leaving it in place, then enable it again later. The
button skips over disabled breakpoints during debugging sessions.
To disable a breakpoint, select the node on the canvas and click its
icon. The breakpoint turns gray, indicating it has been disabled.
To enable a disabled breakpoint, select the node on the canvas and click its
icon. Depending on whether the disabled breakpoint is conditional or unconditional, it turns yellow or red, respectively, to indicate it has been re-enabled.
Note
You can also disable and re-enable breakpoints during debugging sessions. For details, see Chapter 19, Disabling Breakpoints in a Running Context.
Deleting breakpoints
You can delete individual breakpoints or all breakpoints.
- Individual breakpoints—on the canvas, select the node whose breakpoint you want to delete, and click its icon.
- All breakpoints—right-click the canvas, and select Delete all breakpoints.
Related topics
Chapter 15, Starting the Camel Debugger |
chapter "To Debug a Routing Context" in "Tooling Tutorials" |