Package org.apache.camel.impl.debugger
Class BacklogDebugger
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.impl.debugger.BacklogDebugger
-
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
public final class BacklogDebugger extends org.apache.camel.support.service.ServiceSupportADebuggerthat has easy debugging functionality which can be used from JMX withManagedBacklogDebuggerMBean. This implementation allows setting breakpoints (with or without a condition) and inspect theExchangedumped in XML inBacklogTracerEventMessageformat. There is operations to resume suspended breakpoints to continue routing theExchange. There is also step functionality, so you can single step a givenExchange. This implementation will only break the firstExchangethat arrives to a breakpoint. If Camel routes using concurrency then sub-sequentExchangewill continue to be routed, if their breakpoint already holds a suspendedExchange.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBreakpoint(String nodeId)voidaddConditionalBreakpoint(String nodeId, String language, String predicate)booleanafterProcess(org.apache.camel.Exchange exchange, org.apache.camel.Processor processor, org.apache.camel.NamedNode definition, long timeTaken)booleanbeforeProcess(org.apache.camel.Exchange exchange, org.apache.camel.Processor processor, org.apache.camel.NamedNode definition)static BacklogDebuggercreateDebugger(org.apache.camel.CamelContext context)Creates a new backlog debugger.voiddisableBreakpoint(String nodeId)voiddisableDebugger()protected voiddoStart()protected voiddoStop()StringdumpTracedMessagesAsXml(String nodeId)voidenableBreakpoint(String nodeId)voidenableDebugger()static BacklogDebuggergetBacklogDebugger(org.apache.camel.CamelContext context)A helper method to return the BacklogDebugger instance if one is enabledintgetBodyMaxChars()Set<String>getBreakpoints()longgetDebugCounter()longgetFallbackTimeout()StringgetLoggingLevel()Set<String>getSuspendedBreakpointNodeIds()org.apache.camel.ExchangegetSuspendedExchange(String id)Gets the exchanged suspended at the given breakpoint id or null if there is none at that id.booleanhasBreakpoint(String nodeId)booleanisBodyIncludeFiles()booleanisBodyIncludeStreams()booleanisEnabled()booleanisSingleStepMode()voidremoveAllBreakpoints()voidremoveBreakpoint(String nodeId)voidremoveMessageBodyOnBreakpoint(String nodeId)voidremoveMessageHeaderOnBreakpoint(String nodeId, String headerName)voidresetDebugCounter()voidresumeAll()voidresumeBreakpoint(String nodeId)voidsetBodyIncludeFiles(boolean bodyIncludeFiles)voidsetBodyIncludeStreams(boolean bodyIncludeStreams)voidsetBodyMaxChars(int bodyMaxChars)voidsetFallbackTimeout(long fallbackTimeout)voidsetLoggingLevel(String level)voidsetMessageBodyOnBreakpoint(String nodeId, Object body)voidsetMessageBodyOnBreakpoint(String nodeId, Object body, Class<?> type)voidsetMessageHeaderOnBreakpoint(String nodeId, String headerName, Object value)voidsetMessageHeaderOnBreakpoint(String nodeId, String headerName, Object value, Class<?> type)voidstep()voidstepBreakpoint(String nodeId)-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
createDebugger
public static BacklogDebugger createDebugger(org.apache.camel.CamelContext context)
Creates a new backlog debugger.- Parameters:
context- Camel context- Returns:
- a new backlog debugger
-
getBacklogDebugger
public static BacklogDebugger getBacklogDebugger(org.apache.camel.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
-
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()
-
resumeBreakpoint
public void resumeBreakpoint(String nodeId)
-
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 org.apache.camel.NoTypeConversionAvailableException
- Throws:
org.apache.camel.NoTypeConversionAvailableException
-
setMessageHeaderOnBreakpoint
public void setMessageHeaderOnBreakpoint(String nodeId, String headerName, Object value, Class<?> type) throws org.apache.camel.NoTypeConversionAvailableException
- Throws:
org.apache.camel.NoTypeConversionAvailableException
-
getFallbackTimeout
public long getFallbackTimeout()
-
setFallbackTimeout
public void setFallbackTimeout(long fallbackTimeout)
-
removeMessageHeaderOnBreakpoint
public void removeMessageHeaderOnBreakpoint(String nodeId, String headerName)
-
resumeAll
public void resumeAll()
-
stepBreakpoint
public void stepBreakpoint(String nodeId)
-
step
public void step()
-
getSuspendedExchange
public org.apache.camel.Exchange getSuspendedExchange(String id)
Gets the exchanged suspended at the given breakpoint id or null if there is none at that id.- Parameters:
id- - node id for the breakpoint- Returns:
- The suspended exchange or null if there isn't one suspended at the given breakpoint.
-
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)
-
getDebugCounter
public long getDebugCounter()
-
resetDebugCounter
public void resetDebugCounter()
-
beforeProcess
public boolean beforeProcess(org.apache.camel.Exchange exchange, org.apache.camel.Processor processor, org.apache.camel.NamedNode definition)
-
afterProcess
public boolean afterProcess(org.apache.camel.Exchange exchange, org.apache.camel.Processor processor, org.apache.camel.NamedNode definition, long timeTaken)
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
-