public class BacklogDebugger extends ServiceSupport implements InterceptStrategy
Debugger
that has easy debugging functionality which
can be used from JMX with ManagedBacklogDebuggerMBean
.
This implementation allows to set breakpoints (with or without a condition) and inspect the Exchange
dumped in XML in BacklogTracerEventMessage
format. There is operations to resume suspended breakpoints
to continue routing the Exchange
. There is also step functionality so you can single step a given
Exchange
.
This implementation will only break the first Exchange
that arrives to a breakpoint. If Camel routes using
concurrency then sub-sequent Exchange
will continue to be routed, if there breakpoint already holds a
suspended Exchange
.shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Constructor and Description |
---|
BacklogDebugger(CamelContext camelContext) |
Modifier and Type | Method and Description |
---|---|
void |
addBreakpoint(String nodeId) |
void |
addConditionalBreakpoint(String nodeId,
String language,
String predicate) |
boolean |
afterProcess(Exchange exchange,
Processor processor,
ProcessorDefinition<?> definition,
long timeTaken) |
boolean |
beforeProcess(Exchange exchange,
Processor processor,
ProcessorDefinition<?> definition) |
void |
disableBreakpoint(String nodeId) |
void |
disableDebugger() |
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
String |
dumpTracedMessagesAsXml(String nodeId) |
void |
enableBreakpoint(String nodeId) |
void |
enableDebugger() |
static BacklogDebugger |
getBacklogDebugger(CamelContext context)
A helper method to return the BacklogDebugger instance if one is enabled
|
int |
getBodyMaxChars() |
Set<String> |
getBreakpoints() |
long |
getDebugCounter() |
Debugger |
getDebugger() |
long |
getFallbackTimeout() |
String |
getLoggingLevel() |
Set<String> |
getSuspendedBreakpointNodeIds() |
Exchange |
getSuspendedExchange(String id)
Gets the exchanged suspended at the given breakpoint id or null if there is none at that id.
|
boolean |
hasBreakpoint(String nodeId) |
boolean |
isBodyIncludeFiles() |
boolean |
isBodyIncludeStreams() |
boolean |
isEnabled() |
boolean |
isSingleStepMode() |
void |
removeAllBreakpoints() |
void |
removeBreakpoint(String nodeId) |
void |
removeMessageBodyOnBreakpoint(String nodeId) |
void |
removeMessageHeaderOnBreakpoint(String nodeId,
String headerName) |
void |
resetDebugCounter() |
void |
resumeAll() |
void |
resumeBreakpoint(String nodeId) |
void |
setBodyIncludeFiles(boolean bodyIncludeFiles) |
void |
setBodyIncludeStreams(boolean bodyIncludeStreams) |
void |
setBodyMaxChars(int bodyMaxChars) |
void |
setFallbackTimeout(long fallbackTimeout) |
void |
setLoggingLevel(String level) |
void |
setMessageBodyOnBreakpoint(String nodeId,
Object body) |
void |
setMessageBodyOnBreakpoint(String nodeId,
Object body,
Class<?> type) |
void |
setMessageHeaderOnBreakpoint(String nodeId,
String headerName,
Object value) |
void |
setMessageHeaderOnBreakpoint(String nodeId,
String headerName,
Object value,
Class<?> type) |
void |
step() |
void |
stepBreakpoint(String nodeId) |
Processor |
wrapProcessorInInterceptors(CamelContext context,
ProcessorDefinition<?> definition,
Processor target,
Processor nextTarget)
Deprecated.
|
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public BacklogDebugger(CamelContext camelContext)
@Deprecated public Processor wrapProcessorInInterceptors(CamelContext context, ProcessorDefinition<?> definition, Processor target, Processor nextTarget) throws Exception
InterceptStrategy
ProcessorDefinition.wrapProcessor(RouteContext, Processor)
to give the implementor an opportunity to wrap the target processor
in a route.
Important: See the class javadoc for advice on letting interceptor be compatible with the
asynchronous routing engine.wrapProcessorInInterceptors
in interface InterceptStrategy
context
- Camel contextdefinition
- the model this interceptor representstarget
- the processor to be wrappednextTarget
- the next processor to be routed toException
- can be thrownpublic static BacklogDebugger getBacklogDebugger(CamelContext context)
public Debugger getDebugger()
public String getLoggingLevel()
public void setLoggingLevel(String level)
public void enableDebugger()
public void disableDebugger()
public boolean isEnabled()
public boolean hasBreakpoint(String nodeId)
public boolean isSingleStepMode()
public void addBreakpoint(String nodeId)
public void addConditionalBreakpoint(String nodeId, String language, String predicate)
public void removeBreakpoint(String nodeId)
public void removeAllBreakpoints()
public Set<String> getBreakpoints()
public void resumeBreakpoint(String nodeId)
public void setMessageBodyOnBreakpoint(String nodeId, Object body)
public void setMessageBodyOnBreakpoint(String nodeId, Object body, Class<?> type)
public void removeMessageBodyOnBreakpoint(String nodeId)
public void setMessageHeaderOnBreakpoint(String nodeId, String headerName, Object value) throws NoTypeConversionAvailableException
public void setMessageHeaderOnBreakpoint(String nodeId, String headerName, Object value, Class<?> type) throws NoTypeConversionAvailableException
public long getFallbackTimeout()
public void setFallbackTimeout(long fallbackTimeout)
public void removeMessageHeaderOnBreakpoint(String nodeId, String headerName)
public void resumeAll()
public void stepBreakpoint(String nodeId)
public void step()
public Set<String> getSuspendedBreakpointNodeIds()
public Exchange getSuspendedExchange(String id)
id
- - node id for the breakpointpublic void disableBreakpoint(String nodeId)
public void enableBreakpoint(String nodeId)
public int getBodyMaxChars()
public void setBodyMaxChars(int bodyMaxChars)
public boolean isBodyIncludeStreams()
public void setBodyIncludeStreams(boolean bodyIncludeStreams)
public boolean isBodyIncludeFiles()
public void setBodyIncludeFiles(boolean bodyIncludeFiles)
public String dumpTracedMessagesAsXml(String nodeId)
public long getDebugCounter()
public void resetDebugCounter()
public boolean beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition)
public boolean afterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken)
protected void doStart() throws Exception
ServiceSupport
ServiceSupport.doStop()
for more details.doStart
in class ServiceSupport
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.doStop()
method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext
is shutting down.doStop
in class ServiceSupport
Exception
ServiceSupport.doStart()
Apache Camel