Package org.apache.camel.impl.debugger
Class BacklogTracer
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.impl.debugger.BacklogTracer
-
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
public final class BacklogTracer extends org.apache.camel.support.service.ServiceSupportA tracer used for message tracing, storing a copy of the message details in a backlog. This tracer allows to store message tracers per node in the Camel routes. The tracers is stored in a backlog queue (FIFO based) which allows to pull the traced messages on demand.
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_BACKLOG_SIZE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()static BacklogTracercreateTracer(org.apache.camel.CamelContext context)Creates a new backlog tracer.protected voiddoStart()protected voiddoStop()List<org.apache.camel.api.management.mbean.BacklogTracerEventMessage>dumpAllTracedMessages()StringdumpAllTracedMessagesAsXml()List<org.apache.camel.api.management.mbean.BacklogTracerEventMessage>dumpTracedMessages(String nodeId)StringdumpTracedMessagesAsXml(String nodeId)intgetBacklogSize()intgetBodyMaxChars()longgetQueueSize()longgetTraceCounter()StringgetTraceFilter()StringgetTracePattern()longincrementTraceCounter()booleanisBodyIncludeFiles()booleanisBodyIncludeStreams()booleanisEnabled()booleanisRemoveOnDump()booleanisStandby()Whether the tracer is standby.voidresetTraceCounter()voidsetBacklogSize(int backlogSize)voidsetBodyIncludeFiles(boolean bodyIncludeFiles)voidsetBodyIncludeStreams(boolean bodyIncludeStreams)voidsetBodyMaxChars(int bodyMaxChars)voidsetEnabled(boolean enabled)voidsetRemoveOnDump(boolean removeOnDump)voidsetStandby(boolean standby)Whether the tracer is standby.voidsetTraceFilter(String filter)voidsetTracePattern(String tracePattern)booleanshouldTrace(org.apache.camel.NamedNode definition, org.apache.camel.Exchange exchange)Whether or not to trace the given processor definition.voidtraceEvent(DefaultBacklogTracerEventMessage event)-
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
-
-
-
-
Field Detail
-
MAX_BACKLOG_SIZE
public static final int MAX_BACKLOG_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
createTracer
public static BacklogTracer createTracer(org.apache.camel.CamelContext context)
Creates a new backlog tracer.- Parameters:
context- Camel context- Returns:
- a new backlog tracer
-
shouldTrace
public boolean shouldTrace(org.apache.camel.NamedNode definition, org.apache.camel.Exchange exchange)Whether or not to trace the given processor definition.- Parameters:
definition- the processor definitionexchange- the exchange- Returns:
- true to trace, false to skip tracing
-
traceEvent
public void traceEvent(DefaultBacklogTracerEventMessage event)
-
isEnabled
public boolean isEnabled()
-
setEnabled
public void setEnabled(boolean enabled)
-
isStandby
public boolean isStandby()
Whether the tracer is standby. If a tracer is in standby then the tracer is activated during startup and are ready to be enabled manually via JMX or calling the enabled method.
-
setStandby
public void setStandby(boolean standby)
Whether the tracer is standby. If a tracer is in standby then the tracer is activated during startup and are ready to be enabled manually via JMX or calling the enabled method.
-
getBacklogSize
public int getBacklogSize()
-
setBacklogSize
public void setBacklogSize(int backlogSize)
-
isRemoveOnDump
public boolean isRemoveOnDump()
-
setRemoveOnDump
public void setRemoveOnDump(boolean removeOnDump)
-
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)
-
getTracePattern
public String getTracePattern()
-
setTracePattern
public void setTracePattern(String tracePattern)
-
getTraceFilter
public String getTraceFilter()
-
setTraceFilter
public void setTraceFilter(String filter)
-
getTraceCounter
public long getTraceCounter()
-
getQueueSize
public long getQueueSize()
-
resetTraceCounter
public void resetTraceCounter()
-
dumpTracedMessages
public List<org.apache.camel.api.management.mbean.BacklogTracerEventMessage> dumpTracedMessages(String nodeId)
-
dumpAllTracedMessages
public List<org.apache.camel.api.management.mbean.BacklogTracerEventMessage> dumpAllTracedMessages()
-
dumpAllTracedMessagesAsXml
public String dumpAllTracedMessagesAsXml()
-
clear
public void clear()
-
incrementTraceCounter
public long incrementTraceCounter()
-
doStart
protected void doStart() throws Exception- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
-