org.apache.camel.processor.interceptor
Class BacklogDebugger
java.lang.Object
org.apache.camel.support.ServiceSupport
org.apache.camel.processor.interceptor.BacklogDebugger
- All Implemented Interfaces:
- Service, ShutdownableService, InterceptStrategy, StatefulService, SuspendableService
public class BacklogDebugger
- extends ServiceSupport
- implements InterceptStrategy
A 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
.
Method Summary |
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()
|
String |
getLoggingLevel()
|
Set<String> |
getSuspendedBreakpointNodeIds()
|
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 |
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. |
Methods inherited from class org.apache.camel.support.ServiceSupport |
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, start, stop, suspend |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BacklogDebugger
public BacklogDebugger(CamelContext camelContext)
wrapProcessorInInterceptors
@Deprecated
public Processor wrapProcessorInInterceptors(CamelContext context,
ProcessorDefinition<?> definition,
Processor target,
Processor nextTarget)
throws Exception
- Deprecated.
- Description copied from interface:
InterceptStrategy
- This method is invoked by
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.
- Specified by:
wrapProcessorInInterceptors
in interface InterceptStrategy
- Parameters:
context
- Camel contextdefinition
- the model this interceptor representstarget
- the processor to be wrappednextTarget
- the next processor to be routed to
- Returns:
- processor wrapped with an interceptor or not wrapped.
- Throws:
Exception
- can be thrown
getBacklogDebugger
public static BacklogDebugger getBacklogDebugger(CamelContext context)
- A helper method to return the BacklogDebugger instance if one is enabled
- Returns:
- the backlog debugger or null if none can be found
getDebugger
public Debugger getDebugger()
getLoggingLevel
public String getLoggingLevel()
setLoggingLevel
public void setLoggingLevel(String level)
enableDebugger
public void enableDebugger()
disableDebugger
public void disableDebugger()
isEnabled
public boolean isEnabled()
hasBreakpoint
public boolean hasBreakpoint(String nodeId)
isSingleStepMode
public boolean isSingleStepMode()
addBreakpoint
public void addBreakpoint(String nodeId)
addConditionalBreakpoint
public void addConditionalBreakpoint(String nodeId,
String language,
String predicate)
removeBreakpoint
public void removeBreakpoint(String nodeId)
removeAllBreakpoints
public void removeAllBreakpoints()
getBreakpoints
public Set<String> getBreakpoints()
resumeBreakpoint
public void resumeBreakpoint(String nodeId)
setMessageBodyOnBreakpoint
public void setMessageBodyOnBreakpoint(String nodeId,
Object body)
setMessageBodyOnBreakpoint
public void setMessageBodyOnBreakpoint(String nodeId,
Object body,
Class type)
removeMessageBodyOnBreakpoint
public void removeMessageBodyOnBreakpoint(String nodeId)
setMessageHeaderOnBreakpoint
public void setMessageHeaderOnBreakpoint(String nodeId,
String headerName,
Object value)
throws NoTypeConversionAvailableException
- Throws:
NoTypeConversionAvailableException
setMessageHeaderOnBreakpoint
public void setMessageHeaderOnBreakpoint(String nodeId,
String headerName,
Object value,
Class type)
throws NoTypeConversionAvailableException
- Throws:
NoTypeConversionAvailableException
removeMessageHeaderOnBreakpoint
public void removeMessageHeaderOnBreakpoint(String nodeId,
String headerName)
resumeAll
public void resumeAll()
stepBreakpoint
public void stepBreakpoint(String nodeId)
step
public void step()
getSuspendedBreakpointNodeIds
public Set<String> getSuspendedBreakpointNodeIds()
disableBreakpoint
public void disableBreakpoint(String nodeId)
enableBreakpoint
public void enableBreakpoint(String nodeId)
getBodyMaxChars
public int getBodyMaxChars()
setBodyMaxChars
public void setBodyMaxChars(int bodyMaxChars)
isBodyIncludeStreams
public boolean isBodyIncludeStreams()
setBodyIncludeStreams
public void setBodyIncludeStreams(boolean bodyIncludeStreams)
isBodyIncludeFiles
public boolean isBodyIncludeFiles()
setBodyIncludeFiles
public void setBodyIncludeFiles(boolean bodyIncludeFiles)
dumpTracedMessagesAsXml
public String dumpTracedMessagesAsXml(String nodeId)
getDebugCounter
public long getDebugCounter()
resetDebugCounter
public void resetDebugCounter()
beforeProcess
public boolean beforeProcess(Exchange exchange,
Processor processor,
ProcessorDefinition<?> definition)
afterProcess
public boolean afterProcess(Exchange exchange,
Processor processor,
ProcessorDefinition<?> definition,
long timeTaken)
doStart
protected void doStart()
throws Exception
- Description copied from class:
ServiceSupport
- Implementations override this method to support customized start/stop.
Important: See
ServiceSupport.doStop()
for more details.
- Specified by:
doStart
in class ServiceSupport
- Throws:
Exception
- See Also:
ServiceSupport.doStop()
doStop
protected void doStop()
throws Exception
- Description copied from class:
ServiceSupport
- Implementations override this method to support customized start/stop.
Important: Camel will invoke this
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.
- Specified by:
doStop
in class ServiceSupport
- Throws:
Exception
- See Also:
ServiceSupport.doStart()
Apache Camel