Camel 2.x - Debugger APIPage added by Claus IbsenCamel 2.x - Debugger APIAvailable as of Camel 2.4 There is a new org.apache.camel.spi.Debugger API which allows 3rd party to attach a debugger tooling to debug Exchanges in Camel routes. EnablingYou can enable the debugger from the CamelContext using the setDebugger. We may add a nicer API for this in the future. BreakpointThere is a org.apache.camel.spi.Breakpoint API in which the 3rd party tooling implement logic what should happen when the breakpoint is hit. The breakpoint can be invoked in 2 kind of styles in Camel:
The processing is based on a before and after callback when the Exchange is being routed and thus a Processor is invoked. The event is based on the EventNotifer emitting events such as ExchangeCreatedEvent, ExchangeFailureEvent etc. This allows you to have breakpoints when a given Exchange has failed. Or when they are done, so you can inspect the result etc. There is a org.apache.camel.impl.BreakpointSupport class which can be used to extend, to avoid implementing all the methods from the interface. ConditionThere is a org.apache.camel.spi.Condition API in which the 3rd party tooling can provide conditions when the breakpoints should apply. For example a conditional breakpoint which only triggers if the message body is a certain message / type etc. The condition can be invoked in 2 kind of styles in Camel:
Where there is a match method for each style. There is a org.apache.camel.impl.ConditionSupport class which can be used to extend, to avoid implementing all the methods from the interface. ExampleFor example we can have this breakpoint breakpoint = new BreakpointSupport() { public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) { String body = exchange.getIn().getBody(String.class); logs.add("Breakpoint at " + definition + " with body: " + body); } }
Change Notification Preferences
View Online
|
Add Comment
|
- [CONF] Apache Camel > Camel 2.x - Debugger API confluence
- [CONF] Apache Camel > Camel 2.x - Debugger API confluence
- [CONF] Apache Camel > Camel 2.x - Debugger API confluence