Class DynamicRouterControlService
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.component.dynamicrouter.control.DynamicRouterControlService
- All Implemented Interfaces:
AutoCloseable
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
@Converter(generateBulkLoader=true)
@ManagedResource(description="Dynamic Router control operations service")
public class DynamicRouterControlService
extends org.apache.camel.support.service.ServiceSupport
A service for managing dynamic routing subscriptions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Factory class for creating instances ofDynamicRouterControlService
. -
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
ConstructorsConstructorDescriptionDynamicRouterControlService
(org.apache.camel.CamelContext camelContext, DynamicRouterFilterService filterService) Creates a newDynamicRouterControlService
. -
Method Summary
Modifier and TypeMethodDescriptiongetStatisticsForChannel
(String subscribeChannel) Retrieves a copy of the filter statistics map for the provided channel.getSubscriptionsForChannel
(String subscribeChannel) Retrieves a copy of the filter map for the provided channel.Retrieves a copy of the filter map.Retrieves a copy of the filter statistics map.boolean
removeSubscription
(String subscribeChannel, String subscriptionId) Subscribes for dynamic routing with a predicate expression.subscribeWithPredicateBean
(String subscribeChannel, String subscriptionId, String destinationUri, int priority, String predicateBean, boolean update) Subscribes for dynamic routing with the name of a predicate bean in the registry.subscribeWithPredicateExpression
(String subscribeChannel, String subscriptionId, String destinationUri, int priority, String predicate, String expressionLanguage, boolean update) Subscribes for dynamic routing with a predicate expression.subscribeWithPredicateInstance
(String subscribeChannel, String subscriptionId, String destinationUri, int priority, Object predicate, boolean update) Subscribes for dynamic routing with a predicate instance.Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doStart, doStop, doSuspend, fail, getInternalLock, 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
-
Constructor Details
-
DynamicRouterControlService
public DynamicRouterControlService(org.apache.camel.CamelContext camelContext, DynamicRouterFilterService filterService) Creates a newDynamicRouterControlService
.- Parameters:
camelContext
- the camel contextfilterService
- the filter service
-
-
Method Details
-
subscribeWithPredicateExpression
@ManagedOperation(description="Subscribe for dynamic routing with a predicate expression") public String subscribeWithPredicateExpression(String subscribeChannel, String subscriptionId, String destinationUri, int priority, String predicate, String expressionLanguage, boolean update) Subscribes for dynamic routing with a predicate expression.- Parameters:
subscribeChannel
- the subscribe channelsubscriptionId
- the subscription IDdestinationUri
- the destination URIpriority
- the prioritypredicate
- the predicateexpressionLanguage
- the expression languageupdate
- whether to update the subscription if it already exists, or add a new one- Returns:
- the subscription ID for the added/updated subscription
-
subscribeWithPredicateBean
@ManagedOperation(description="Subscribe for dynamic routing with the name of a predicate bean in the registry") public String subscribeWithPredicateBean(String subscribeChannel, String subscriptionId, String destinationUri, int priority, String predicateBean, boolean update) Subscribes for dynamic routing with the name of a predicate bean in the registry.- Parameters:
subscribeChannel
- the subscribe channelsubscriptionId
- the subscription IDdestinationUri
- the destination URIpriority
- the prioritypredicateBean
- the predicate bean nameupdate
- whether to update the subscription if it already exists, or add a new one- Returns:
- the subscription ID for the added/updated subscription
-
subscribeWithPredicateInstance
@ManagedOperation(description="Subscribe for dynamic routing with a predicate instance") public String subscribeWithPredicateInstance(String subscribeChannel, String subscriptionId, String destinationUri, int priority, Object predicate, boolean update) Subscribes for dynamic routing with a predicate instance.- Parameters:
subscribeChannel
- the subscribe channelsubscriptionId
- the subscription IDdestinationUri
- the destination URIpriority
- the prioritypredicate
- the predicate instanceupdate
- whether to update the subscription if it already exists, or add a new one- Returns:
- the subscription ID for the added/updated subscription
-
removeSubscription
@ManagedOperation(description="Unsubscribe for dynamic routing on a channel by subscription ID") public boolean removeSubscription(String subscribeChannel, String subscriptionId) Subscribes for dynamic routing with a predicate expression.- Parameters:
subscribeChannel
- the subscribe channelsubscriptionId
- the subscription ID- Returns:
- true if the subscription was removed, false otherwise
-
getSubscriptionsMap
@ManagedAttribute(description="Get the map of filters for all dynamic router channels") public Map<String,ConcurrentSkipListSet<PrioritizedFilter>> getSubscriptionsMap()Retrieves a copy of the filter map.- Returns:
- a copy of the filter map
-
getSubscriptionsStatisticsMap
@ManagedAttribute(description="Get the map of statistics for all dynamic router channels") public Map<String,List<PrioritizedFilterStatistics>> getSubscriptionsStatisticsMap()Retrieves a copy of the filter statistics map.- Returns:
- a copy of the filter statistics map
-
getSubscriptionsForChannel
Retrieves a copy of the filter map for the provided channel.- Parameters:
subscribeChannel
- the subscribe channel- Returns:
- a copy of the filter map for the provided channel
-
getStatisticsForChannel
Retrieves a copy of the filter statistics map for the provided channel.- Parameters:
subscribeChannel
- the subscribe channel- Returns:
- a copy of the filter statistics map for the provided channel
-