Setting breakpoints in your routes

Camel's ability to allow you to create route "recipes" (definitions) is very powerful, but it can make traditional debugging difficult. You cannot easily set a breakpoint on a line of Spring XML. Likewise, setting a breakpoint in your RouteBuilder.configure() method will not yield the results you want as it only gets called once at startup when your route definition is parsed into a runtime route (other code).

This recipe will show you how, in your unit tests, to define methods that will be called before and after every processor step, giving you a line of Java code where you can set breakpoints to more easily debug your code.

Getting ready

The Java code for this recipe is located in the org.camelcookbook.monitoring.debug ...

Get Apache Camel Developer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.