Package org.apache.camel.spi
Interface BacklogDebugger
- All Superinterfaces:
AutoCloseable,Service,ShutdownableService,StatefulService,SuspendableService
A
.
This implementation allows setting breakpoints (with or without a condition) and inspect the
Debugger that has easy debugging functionality which can be used from JMX with
invalid reference
org.apache.camel.api.management.mbean.ManagedBacklogDebuggerMBean
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 their breakpoint already holds a
suspended Exchange.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSpecial breakpoint id token to automatically add breakpoint for every route.static final StringThe name of the OS environment variable that contains the value of the flag indicating whether theBacklogDebuggershould suspend processing the messages and wait for a debugger to attach or not.static final StringThe name of the system property that contains the value of the flag indicating whether theBacklogDebuggershould suspend processing the messages and wait for a debugger to attach or not. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBreakpoint(String nodeId) Adds a breakpoint for the given nodevoidaddConditionalBreakpoint(String nodeId, String language, String predicate) Adds a conditional breakpoint for the given nodevoidafterProcess(Exchange exchange, Processor processor, NamedNode definition, long timeTaken) Callback invoked after a breakpointvoidattach()Attach the debugger which will resume the message processing in case the suspend mode is enabled.org.apache.camel.util.StopWatchbeforeProcess(Exchange exchange, Processor processor, NamedNode definition) Callback invoked before hitting a breakpointvoiddetach()Detach the debugger which will suspend the message processing in case the suspend mode is enabled.voiddisableBreakpoint(String nodeId) Disables a breakpointvoidTo disable and stop the debuggerdumpTracedMessagesAsJSon(String nodeId) To dump the debugged messages from the give node id in JSon format.dumpTracedMessagesAsXml(String nodeId) To dump the debugged messages from the give node id in XML format.voidenableBreakpoint(String nodeId) Enables a breakpointvoidTo enable and start the debuggerintTo limit the message body to a maximum size in the traced message.Gets all the breakpoint (node ids)longNumber of breakpoint that has been hitlongFallback Timeout in seconds (300 seconds as default) when block the message processing in Camel.Allows to pre-configure breakpoints (node ids) to use with debugger on startup.The debugger logging level to use when logging activity.Gets the trace event for the suspended exchange at the given breakpoint id or null if there is none at that id.Gets node ids for all current suspended exchanges at breakpointsGets the exchanged suspended at the given breakpoint id or null if there is none at that id.Gets the exchange ids for all current suspended exchangesbooleanhasBreakpoint(String nodeId) Does the node have a breakpointbooleanWhether to include the message body of file based messages.booleanWhether to include the message body of stream based messages.booleanWhether the debugger is enabledbooleanTrace messages to include exception if the message failedbooleanWhether to include the exchange properties in the traced messagebooleanWhether to include the exchange variables in the traced messagebooleanIn single step mode, then when the exchange is created and completed, then simulate a breakpoint at start and end, that allows to suspend and watch the incoming/complete exchange at the route (you can see message body as response, failed exception etc).booleanIs the debugger currently in single step modebooleanWhether the debugger is standby.booleanWhether the debugger should suspend on startup, and wait for a remote debugger to attach.voidRemove all breakpointsvoidremoveBreakpoint(String nodeId) Removes the breakpointvoidremoveExchangePropertyOnBreakpoint(String nodeId, String exchangePropertyName) Removes the exchange property at the given breakpointvoidremoveExchangeVariableOnBreakpoint(String nodeId, String variableName) Removes the variable on the suspended breakpoint at the given node idvoidremoveMessageBodyOnBreakpoint(String nodeId) Removes the message body (set as null) at the given breakpointvoidremoveMessageHeaderOnBreakpoint(String nodeId, String headerName) Removes the message header at the given breakpointvoidRests the debug countervoidTo resume all suspended breakpoints.voidresumeBreakpoint(String nodeId) Resume the breakpointvoidresumeBreakpoint(String nodeId, boolean stepMode) Resume the breakpoint in step modevoidsetBodyIncludeFiles(boolean bodyIncludeFiles) Whether to include the message body of file based messages.voidsetBodyIncludeStreams(boolean bodyIncludeStreams) Whether to include the message body of stream based messages.voidsetBodyMaxChars(int bodyMaxChars) To limit the message body to a maximum size in the traced message.voidsetEnabled(boolean enabled) To configure whether the debugger should be enabledvoidsetExchangePropertyOnBreakpoint(String nodeId, String exchangePropertyName, Object value) Sets the exchange property at the given breakpointvoidsetExchangePropertyOnBreakpoint(String nodeId, String exchangePropertyName, Object value, Class<?> type) Updates the exchange property at the given breakpointvoidsetExchangeVariableOnBreakpoint(String nodeId, String variableName, Object value) Updates/adds the variable (uses same type as old variableName value) on the suspended breakpoint at the given node idvoidsetExchangeVariableOnBreakpoint(String nodeId, String variableName, Object value, Class<?> type) Updates/adds the variable (with a new type) on the suspended breakpoint at the given node idvoidsetFallbackTimeout(long fallbackTimeout) Fallback Timeout in seconds (300 seconds as default) when block the message processing in Camel.voidsetIncludeException(boolean includeException) Trace messages to include exception if the message failedvoidsetIncludeExchangeProperties(boolean includeExchangeProperties) Whether to include the exchange properties in the traced messagevoidsetIncludeExchangeVariables(boolean includeExchangeVariables) Whether to include the exchange variables in the traced messagevoidsetInitialBreakpoints(String initialBreakpoints) Allows to pre-configure breakpoints (node ids) to use with debugger on startup.voidsetLoggingLevel(String level) The debugger logging level to use when logging activity.voidsetMessageBodyOnBreakpoint(String nodeId, Object body) Updates the message body at the given breakpointvoidsetMessageBodyOnBreakpoint(String nodeId, Object body, Class<?> type) Updates the message body at the given breakpointvoidsetMessageHeaderOnBreakpoint(String nodeId, String headerName, Object value) Sets the message header at the given breakpointvoidsetMessageHeaderOnBreakpoint(String nodeId, String headerName, Object value, Class<?> type) Sets the message header at the given breakpointvoidsetSingleStepIncludeStartEnd(boolean singleStepIncludeStartEnd) In single step mode, then when the exchange is created and completed, then simulate a breakpoint at start and end, that allows to suspend and watch the incoming/complete exchange at the route (you can see message body as response, failed exception etc).voidsetStandby(boolean standby) Whether the debugger is standby.voidsetSuspendMode(boolean suspendMode) Whether the debugger should suspend on startup, and wait for a remote debugger to attach.voidskipOver()To skip over (does not call the node) to next node when in single step mode.voidstep()To step (into) to next node when in single step mode.voidTo start single step mode from the current suspended breakpoint.voidstepBreakpoint(String nodeId) To start single step mode from a suspended breakpoint at the given node.voidstepOver()To step over to next node when in single step mode.Methods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Field Details
-
SUSPEND_MODE_ENV_VAR_NAME
The name of the OS environment variable that contains the value of the flag indicating whether theBacklogDebuggershould suspend processing the messages and wait for a debugger to attach or not.- See Also:
-
SUSPEND_MODE_SYSTEM_PROP_NAME
The name of the system property that contains the value of the flag indicating whether theBacklogDebuggershould suspend processing the messages and wait for a debugger to attach or not.- See Also:
-
BREAKPOINT_ALL_ROUTES
Special breakpoint id token to automatically add breakpoint for every route.- See Also:
-
-
Method Details
-
getInitialBreakpoints
String getInitialBreakpoints()Allows to pre-configure breakpoints (node ids) to use with debugger on startup. Multiple ids can be separated by comma. Use special value _all_routes_ to add a breakpoint for the first node for every route, in other words this makes it easy to debug from the beginning of every route without knowing the exact node ids. -
setInitialBreakpoints
Allows to pre-configure breakpoints (node ids) to use with debugger on startup. Multiple ids can be separated by comma. Use special value _all_routes_ to add a breakpoint for the first node for every route, in other words this makes it easy to debug from the beginning of every route without knowing the exact node ids. -
getLoggingLevel
String getLoggingLevel()The debugger logging level to use when logging activity. -
setLoggingLevel
The debugger logging level to use when logging activity. -
enableDebugger
void enableDebugger()To enable and start the debugger -
disableDebugger
void disableDebugger()To disable and stop the debugger -
setEnabled
void setEnabled(boolean enabled) To configure whether the debugger should be enabled -
isEnabled
boolean isEnabled()Whether the debugger is enabled -
isStandby
boolean isStandby()Whether the debugger is standby.If a debugger is in standby then the tracer is activated during startup and are ready to be enabled manually via JMX or calling the enableDebugger method.
-
setStandby
void setStandby(boolean standby) Whether the debugger is standby.If a debugger is in standby then the tracer is activated during startup and are ready to be enabled manually via JMX or calling the enableDebugger method.
-
hasBreakpoint
Does the node have a breakpoint -
setSuspendMode
void setSuspendMode(boolean suspendMode) Whether the debugger should suspend on startup, and wait for a remote debugger to attach. This is what the IDEA and VSCode tooling is using. -
isSuspendMode
boolean isSuspendMode()Whether the debugger should suspend on startup, and wait for a remote debugger to attach. This is what the IDEA and VSCode tooling is using. -
isSingleStepMode
boolean isSingleStepMode()Is the debugger currently in single step mode -
attach
void attach()Attach the debugger which will resume the message processing in case the suspend mode is enabled. Do nothing otherwise. -
detach
void detach()Detach the debugger which will suspend the message processing in case the suspend mode is enabled. Do nothing otherwise. -
addBreakpoint
Adds a breakpoint for the given node -
addConditionalBreakpoint
Adds a conditional breakpoint for the given node -
removeBreakpoint
Removes the breakpoint -
removeAllBreakpoints
void removeAllBreakpoints()Remove all breakpoints -
getBreakpoints
Gets all the breakpoint (node ids) -
resumeBreakpoint
Resume the breakpoint -
resumeBreakpoint
Resume the breakpoint in step mode -
setMessageBodyOnBreakpoint
Updates the message body at the given breakpoint -
setMessageBodyOnBreakpoint
Updates the message body at the given breakpoint -
removeMessageBodyOnBreakpoint
Removes the message body (set as null) at the given breakpoint -
setMessageHeaderOnBreakpoint
void setMessageHeaderOnBreakpoint(String nodeId, String headerName, Object value) throws NoTypeConversionAvailableException Sets the message header at the given breakpoint -
setMessageHeaderOnBreakpoint
void setMessageHeaderOnBreakpoint(String nodeId, String headerName, Object value, Class<?> type) throws NoTypeConversionAvailableException Sets the message header at the given breakpoint -
setExchangePropertyOnBreakpoint
void setExchangePropertyOnBreakpoint(String nodeId, String exchangePropertyName, Object value) throws NoTypeConversionAvailableException Sets the exchange property at the given breakpoint -
setExchangePropertyOnBreakpoint
void setExchangePropertyOnBreakpoint(String nodeId, String exchangePropertyName, Object value, Class<?> type) throws NoTypeConversionAvailableException Updates the exchange property at the given breakpoint -
removeMessageHeaderOnBreakpoint
Removes the message header at the given breakpoint -
removeExchangePropertyOnBreakpoint
Removes the exchange property at the given breakpoint -
setExchangeVariableOnBreakpoint
void setExchangeVariableOnBreakpoint(String nodeId, String variableName, Object value) throws NoTypeConversionAvailableException Updates/adds the variable (uses same type as old variableName value) on the suspended breakpoint at the given node id -
setExchangeVariableOnBreakpoint
void setExchangeVariableOnBreakpoint(String nodeId, String variableName, Object value, Class<?> type) throws NoTypeConversionAvailableException Updates/adds the variable (with a new type) on the suspended breakpoint at the given node id -
removeExchangeVariableOnBreakpoint
Removes the variable on the suspended breakpoint at the given node id -
getFallbackTimeout
long getFallbackTimeout()Fallback Timeout in seconds (300 seconds as default) when block the message processing in Camel. A timeout used for waiting for a message to arrive at a given breakpoint. -
setFallbackTimeout
void setFallbackTimeout(long fallbackTimeout) Fallback Timeout in seconds (300 seconds as default) when block the message processing in Camel. A timeout used for waiting for a message to arrive at a given breakpoint. -
resumeAll
void resumeAll()To resume all suspended breakpoints. -
stepBreakpoint
To start single step mode from a suspended breakpoint at the given node. Then invokestep()to step to next node in the route. -
stepBreakpoint
void stepBreakpoint()To start single step mode from the current suspended breakpoint. Then invokestep()to step to next node in the route. -
step
void step()To step (into) to next node when in single step mode. -
stepOver
void stepOver()To step over to next node when in single step mode. -
skipOver
void skipOver()To skip over (does not call the node) to next node when in single step mode. -
getSuspendedBreakpointNodeIds
Gets node ids for all current suspended exchanges at breakpoints -
getSuspendedExchangeIds
Gets the exchange ids for all current suspended exchanges -
getSuspendedExchange
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.
-
getSuspendedBreakpointMessage
Gets the trace event for the suspended exchange at the given breakpoint id or null if there is none at that id.- Parameters:
id- node id for the breakpoint- Returns:
- the trace event or null if there isn't one suspended at the given breakpoint.
-
disableBreakpoint
Disables a breakpoint -
enableBreakpoint
Enables a breakpoint -
setSingleStepIncludeStartEnd
void setSingleStepIncludeStartEnd(boolean singleStepIncludeStartEnd) In single step mode, then when the exchange is created and completed, then simulate a breakpoint at start and end, that allows to suspend and watch the incoming/complete exchange at the route (you can see message body as response, failed exception etc). -
isSingleStepIncludeStartEnd
boolean isSingleStepIncludeStartEnd()In single step mode, then when the exchange is created and completed, then simulate a breakpoint at start and end, that allows to suspend and watch the incoming/complete exchange at the route (you can see message body as response, failed exception etc). -
getBodyMaxChars
int getBodyMaxChars()To limit the message body to a maximum size in the traced message. Use 0 or negative value to use unlimited size. -
setBodyMaxChars
void setBodyMaxChars(int bodyMaxChars) To limit the message body to a maximum size in the traced message. Use 0 or negative value to use unlimited size. -
isBodyIncludeStreams
boolean isBodyIncludeStreams()Whether to include the message body of stream based messages. If enabled then beware the stream may not be re-readable later. See more about Stream Caching. -
setBodyIncludeStreams
void setBodyIncludeStreams(boolean bodyIncludeStreams) Whether to include the message body of stream based messages. If enabled then beware the stream may not be re-readable later. See more about Stream Caching. -
isBodyIncludeFiles
boolean isBodyIncludeFiles()Whether to include the message body of file based messages. The overhead is that the file content has to be read from the file. -
setBodyIncludeFiles
void setBodyIncludeFiles(boolean bodyIncludeFiles) Whether to include the message body of file based messages. The overhead is that the file content has to be read from the file. -
isIncludeExchangeProperties
boolean isIncludeExchangeProperties()Whether to include the exchange properties in the traced message -
setIncludeExchangeProperties
void setIncludeExchangeProperties(boolean includeExchangeProperties) Whether to include the exchange properties in the traced message -
isIncludeExchangeVariables
boolean isIncludeExchangeVariables()Whether to include the exchange variables in the traced message -
setIncludeExchangeVariables
void setIncludeExchangeVariables(boolean includeExchangeVariables) Whether to include the exchange variables in the traced message -
isIncludeException
boolean isIncludeException()Trace messages to include exception if the message failed -
setIncludeException
void setIncludeException(boolean includeException) Trace messages to include exception if the message failed -
dumpTracedMessagesAsXml
To dump the debugged messages from the give node id in XML format. -
dumpTracedMessagesAsJSon
To dump the debugged messages from the give node id in JSon format. -
getDebugCounter
long getDebugCounter()Number of breakpoint that has been hit -
resetDebugCounter
void resetDebugCounter()Rests the debug counter -
beforeProcess
org.apache.camel.util.StopWatch beforeProcess(Exchange exchange, Processor processor, NamedNode definition) Callback invoked before hitting a breakpoint -
afterProcess
Callback invoked after a breakpoint
-