Class MetricsRoutePolicy
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.RoutePolicySupport
org.apache.camel.component.metrics.routepolicy.MetricsRoutePolicy
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.NonManagedService
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.RoutePolicy
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
public class MetricsRoutePolicy
extends org.apache.camel.support.RoutePolicySupport
implements org.apache.camel.NonManagedService
A
RoutePolicy
which gathers statistics and reports them using
MetricRegistry
.
The metrics is reported in JMX by default, but this can be configured.-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.codahale.metrics.MetricRegistry
boolean
boolean
isUseJmx()
void
onExchangeBegin
(org.apache.camel.Route route, org.apache.camel.Exchange exchange) void
onExchangeDone
(org.apache.camel.Route route, org.apache.camel.Exchange exchange) void
onInit
(org.apache.camel.Route route) void
setDurationUnit
(TimeUnit durationUnit) void
setJmxDomain
(String jmxDomain) void
setMetricsRegistry
(com.codahale.metrics.MetricRegistry metricsRegistry) void
setNamePattern
(String namePattern) The name pattern to use.void
setPrettyPrint
(boolean prettyPrint) void
setRateUnit
(TimeUnit rateUnit) void
setUseJmx
(boolean useJmx) Methods inherited from class org.apache.camel.support.RoutePolicySupport
controller, getExceptionHandler, handleException, onRemove, onResume, onStart, onStop, onSuspend, resumeOrStartConsumer, resumeRoute, setExceptionHandler, startConsumer, startRoute, stopConsumer, stopRoute, stopRoute, stopRouteAsync, suspendOrStopConsumer, suspendRoute, suspendRoute
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doStart, doStop, 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
Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.ShutdownableService
shutdown
Methods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Field Details
-
NAME_TOKEN
- See Also:
-
ROUTE_ID_TOKEN
- See Also:
-
TYPE_TOKEN
- See Also:
-
-
Constructor Details
-
MetricsRoutePolicy
public MetricsRoutePolicy()
-
-
Method Details
-
getMetricsRegistry
public com.codahale.metrics.MetricRegistry getMetricsRegistry() -
setMetricsRegistry
public void setMetricsRegistry(com.codahale.metrics.MetricRegistry metricsRegistry) -
isUseJmx
public boolean isUseJmx() -
setUseJmx
public void setUseJmx(boolean useJmx) -
getJmxDomain
-
setJmxDomain
-
isPrettyPrint
public boolean isPrettyPrint() -
setPrettyPrint
public void setPrettyPrint(boolean prettyPrint) -
getRateUnit
-
setRateUnit
-
getDurationUnit
-
setDurationUnit
-
getNamePattern
-
setNamePattern
The name pattern to use. Uses dot as separators, but you can change that. The values ##name##, ##routeId##, and ##type## will be replaced with actual value. -
onInit
public void onInit(org.apache.camel.Route route) - Specified by:
onInit
in interfaceorg.apache.camel.spi.RoutePolicy
- Overrides:
onInit
in classorg.apache.camel.support.RoutePolicySupport
-
onExchangeBegin
public void onExchangeBegin(org.apache.camel.Route route, org.apache.camel.Exchange exchange) - Specified by:
onExchangeBegin
in interfaceorg.apache.camel.spi.RoutePolicy
- Overrides:
onExchangeBegin
in classorg.apache.camel.support.RoutePolicySupport
-
onExchangeDone
public void onExchangeDone(org.apache.camel.Route route, org.apache.camel.Exchange exchange) - Specified by:
onExchangeDone
in interfaceorg.apache.camel.spi.RoutePolicy
- Overrides:
onExchangeDone
in classorg.apache.camel.support.RoutePolicySupport
-