Class BacklogTracer

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.BacklogTracer, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    public final class BacklogTracer
    extends org.apache.camel.support.service.ServiceSupport
    implements org.apache.camel.spi.BacklogTracer
    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.

    • 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 definition
        exchange - the exchange
        Returns:
        true to trace, false to skip tracing
      • isEnabled

        public boolean isEnabled()
        Specified by:
        isEnabled in interface org.apache.camel.spi.BacklogTracer
      • setEnabled

        public void setEnabled​(boolean enabled)
        Specified by:
        setEnabled in interface org.apache.camel.spi.BacklogTracer
      • isStandby

        public boolean isStandby()
        Specified by:
        isStandby in interface org.apache.camel.spi.BacklogTracer
      • setStandby

        public void setStandby​(boolean standby)
        Specified by:
        setStandby in interface org.apache.camel.spi.BacklogTracer
      • getBacklogSize

        public int getBacklogSize()
        Specified by:
        getBacklogSize in interface org.apache.camel.spi.BacklogTracer
      • setBacklogSize

        public void setBacklogSize​(int backlogSize)
        Specified by:
        setBacklogSize in interface org.apache.camel.spi.BacklogTracer
      • isRemoveOnDump

        public boolean isRemoveOnDump()
        Specified by:
        isRemoveOnDump in interface org.apache.camel.spi.BacklogTracer
      • setRemoveOnDump

        public void setRemoveOnDump​(boolean removeOnDump)
        Specified by:
        setRemoveOnDump in interface org.apache.camel.spi.BacklogTracer
      • getBodyMaxChars

        public int getBodyMaxChars()
        Specified by:
        getBodyMaxChars in interface org.apache.camel.spi.BacklogTracer
      • setBodyMaxChars

        public void setBodyMaxChars​(int bodyMaxChars)
        Specified by:
        setBodyMaxChars in interface org.apache.camel.spi.BacklogTracer
      • isBodyIncludeStreams

        public boolean isBodyIncludeStreams()
        Specified by:
        isBodyIncludeStreams in interface org.apache.camel.spi.BacklogTracer
      • setBodyIncludeStreams

        public void setBodyIncludeStreams​(boolean bodyIncludeStreams)
        Specified by:
        setBodyIncludeStreams in interface org.apache.camel.spi.BacklogTracer
      • isBodyIncludeFiles

        public boolean isBodyIncludeFiles()
        Specified by:
        isBodyIncludeFiles in interface org.apache.camel.spi.BacklogTracer
      • setBodyIncludeFiles

        public void setBodyIncludeFiles​(boolean bodyIncludeFiles)
        Specified by:
        setBodyIncludeFiles in interface org.apache.camel.spi.BacklogTracer
      • isTraceRests

        public boolean isTraceRests()
        Specified by:
        isTraceRests in interface org.apache.camel.spi.BacklogTracer
      • setTraceRests

        public void setTraceRests​(boolean traceRests)
        Specified by:
        setTraceRests in interface org.apache.camel.spi.BacklogTracer
      • isTraceTemplates

        public boolean isTraceTemplates()
        Specified by:
        isTraceTemplates in interface org.apache.camel.spi.BacklogTracer
      • setTraceTemplates

        public void setTraceTemplates​(boolean traceTemplates)
        Specified by:
        setTraceTemplates in interface org.apache.camel.spi.BacklogTracer
      • getTracePattern

        public String getTracePattern()
        Specified by:
        getTracePattern in interface org.apache.camel.spi.BacklogTracer
      • setTracePattern

        public void setTracePattern​(String tracePattern)
        Specified by:
        setTracePattern in interface org.apache.camel.spi.BacklogTracer
      • getTraceFilter

        public String getTraceFilter()
        Specified by:
        getTraceFilter in interface org.apache.camel.spi.BacklogTracer
      • setTraceFilter

        public void setTraceFilter​(String filter)
        Specified by:
        setTraceFilter in interface org.apache.camel.spi.BacklogTracer
      • getTraceCounter

        public long getTraceCounter()
        Specified by:
        getTraceCounter in interface org.apache.camel.spi.BacklogTracer
      • getQueueSize

        public long getQueueSize()
        Specified by:
        getQueueSize in interface org.apache.camel.spi.BacklogTracer
      • resetTraceCounter

        public void resetTraceCounter()
        Specified by:
        resetTraceCounter in interface org.apache.camel.spi.BacklogTracer
      • dumpTracedMessages

        public List<org.apache.camel.spi.BacklogTracerEventMessage> dumpTracedMessages​(String nodeId)
        Specified by:
        dumpTracedMessages in interface org.apache.camel.spi.BacklogTracer
      • dumpTracedMessagesAsXml

        public String dumpTracedMessagesAsXml​(String nodeId)
        Specified by:
        dumpTracedMessagesAsXml in interface org.apache.camel.spi.BacklogTracer
      • dumpTracedMessagesAsJSon

        public String dumpTracedMessagesAsJSon​(String nodeId)
        Specified by:
        dumpTracedMessagesAsJSon in interface org.apache.camel.spi.BacklogTracer
      • dumpAllTracedMessages

        public List<org.apache.camel.spi.BacklogTracerEventMessage> dumpAllTracedMessages()
        Specified by:
        dumpAllTracedMessages in interface org.apache.camel.spi.BacklogTracer
      • dumpAllTracedMessagesAsXml

        public String dumpAllTracedMessagesAsXml()
        Specified by:
        dumpAllTracedMessagesAsXml in interface org.apache.camel.spi.BacklogTracer
      • dumpAllTracedMessagesAsJSon

        public String dumpAllTracedMessagesAsJSon()
        Specified by:
        dumpAllTracedMessagesAsJSon in interface org.apache.camel.spi.BacklogTracer
      • clear

        public void clear()
        Specified by:
        clear in interface org.apache.camel.spi.BacklogTracer
      • incrementTraceCounter

        public long incrementTraceCounter()
      • doStart

        protected void doStart()
                        throws Exception
        Overrides:
        doStart in class org.apache.camel.support.service.BaseService
        Throws:
        Exception
      • doStop

        protected void doStop()
                       throws Exception
        Overrides:
        doStop in class org.apache.camel.support.service.BaseService
        Throws:
        Exception