Class BacklogTracer
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.processor.interceptor.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.ServiceSupport
A 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 int
MAX_BACKLOG_SIZE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
static BacklogTracer
createTracer(org.apache.camel.CamelContext context)
Creates a new backlog tracer.protected void
doStart()
protected void
doStop()
List<org.apache.camel.api.management.mbean.BacklogTracerEventMessage>
dumpAllTracedMessages()
String
dumpAllTracedMessagesAsXml()
List<org.apache.camel.api.management.mbean.BacklogTracerEventMessage>
dumpTracedMessages(String nodeId)
String
dumpTracedMessagesAsXml(String nodeId)
int
getBacklogSize()
int
getBodyMaxChars()
long
getTraceCounter()
String
getTraceFilter()
String
getTracePattern()
long
incrementTraceCounter()
boolean
isBodyIncludeFiles()
boolean
isBodyIncludeStreams()
boolean
isEnabled()
boolean
isRemoveOnDump()
void
resetTraceCounter()
void
setBacklogSize(int backlogSize)
void
setBodyIncludeFiles(boolean bodyIncludeFiles)
void
setBodyIncludeStreams(boolean bodyIncludeStreams)
void
setBodyMaxChars(int bodyMaxChars)
void
setEnabled(boolean enabled)
void
setRemoveOnDump(boolean removeOnDump)
void
setTraceFilter(String filter)
void
setTracePattern(String tracePattern)
boolean
shouldTrace(org.apache.camel.NamedNode definition, org.apache.camel.Exchange exchange)
Whether or not to trace the given processor definition.void
traceEvent(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)
-
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()
-
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:
doStart
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
-