Class EtcdRoutePolicy
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.RoutePolicySupport
-
- org.apache.camel.component.etcd.policy.EtcdRoutePolicy
-
- All Implemented Interfaces:
AutoCloseable
,mousio.client.promises.ResponsePromise.IsSimplePromiseResponseHandler<mousio.etcd4j.responses.EtcdKeysResponse>
,org.apache.camel.CamelContextAware
,org.apache.camel.Service
,org.apache.camel.ShutdownableService
,org.apache.camel.spi.RoutePolicy
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
@ManagedResource(description="Route policy using Etcd as clustered lock") public class EtcdRoutePolicy extends org.apache.camel.support.RoutePolicySupport implements mousio.client.promises.ResponsePromise.IsSimplePromiseResponseHandler<mousio.etcd4j.responses.EtcdKeysResponse>, org.apache.camel.CamelContextAware
-
-
Constructor Summary
Constructors Constructor Description EtcdRoutePolicy()
EtcdRoutePolicy(String clientUris)
EtcdRoutePolicy(mousio.etcd4j.EtcdClient client)
EtcdRoutePolicy(mousio.etcd4j.EtcdClient client, boolean managedClient)
EtcdRoutePolicy(EtcdConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doStart()
protected void
doStop()
org.apache.camel.CamelContext
getCamelContext()
mousio.etcd4j.EtcdClient
getClient()
String
getClientUris()
String
getEndpointUrl()
String
getRouteId()
String
getServiceName()
String
getServicePath()
int
getTtl()
int
getWatchTimeout()
boolean
isLeader()
boolean
isShouldStopConsumer()
void
onInit(org.apache.camel.Route route)
void
onResponse(mousio.client.promises.ResponsePromise<mousio.etcd4j.responses.EtcdKeysResponse> promise)
void
onStart(org.apache.camel.Route route)
void
onStop(org.apache.camel.Route route)
void
onSuspend(org.apache.camel.Route route)
void
setCamelContext(org.apache.camel.CamelContext camelContext)
void
setClientUris(String clientUris)
protected void
setLeader(boolean isLeader)
void
setServiceName(String serviceName)
void
setServicePath(String servicePath)
void
setShouldStopConsumer(boolean shouldStopConsumer)
void
setTtl(int ttl)
void
setWatchTimeout(int watchTimeout)
-
Methods inherited from class org.apache.camel.support.RoutePolicySupport
controller, getExceptionHandler, handleException, onExchangeBegin, onExchangeDone, onRemove, onResume, 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, 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
-
-
-
-
Constructor Detail
-
EtcdRoutePolicy
public EtcdRoutePolicy()
-
EtcdRoutePolicy
public EtcdRoutePolicy(EtcdConfiguration configuration) throws Exception
- Throws:
Exception
-
EtcdRoutePolicy
public EtcdRoutePolicy(mousio.etcd4j.EtcdClient client)
-
EtcdRoutePolicy
public EtcdRoutePolicy(mousio.etcd4j.EtcdClient client, boolean managedClient)
-
EtcdRoutePolicy
public EtcdRoutePolicy(String clientUris)
-
-
Method Detail
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()
- Specified by:
getCamelContext
in interfaceorg.apache.camel.CamelContextAware
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext)
- Specified by:
setCamelContext
in interfaceorg.apache.camel.CamelContextAware
-
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
-
onStart
public void onStart(org.apache.camel.Route route)
- Specified by:
onStart
in interfaceorg.apache.camel.spi.RoutePolicy
- Overrides:
onStart
in classorg.apache.camel.support.RoutePolicySupport
-
onStop
public void onStop(org.apache.camel.Route route)
- Specified by:
onStop
in interfaceorg.apache.camel.spi.RoutePolicy
- Overrides:
onStop
in classorg.apache.camel.support.RoutePolicySupport
-
onSuspend
public void onSuspend(org.apache.camel.Route route)
- Specified by:
onSuspend
in interfaceorg.apache.camel.spi.RoutePolicy
- Overrides:
onSuspend
in classorg.apache.camel.support.RoutePolicySupport
-
doStart
protected void doStart() throws Exception
- Overrides:
doStart
in classorg.apache.camel.support.RoutePolicySupport
- Throws:
Exception
-
doStop
protected void doStop() throws Exception
- Overrides:
doStop
in classorg.apache.camel.support.RoutePolicySupport
- Throws:
Exception
-
setLeader
protected void setLeader(boolean isLeader)
-
getClient
public mousio.etcd4j.EtcdClient getClient()
-
getRouteId
@ManagedAttribute(description="The route id") public String getRouteId()
-
getEndpointUrl
@ManagedAttribute(description="The consumer endpoint", mask=true) public String getEndpointUrl()
-
getServiceName
public String getServiceName()
-
setServiceName
@ManagedAttribute(description="The etcd service name") public void setServiceName(String serviceName)
-
getServicePath
@ManagedAttribute(description="The etcd service path") public String getServicePath()
-
setServicePath
public void setServicePath(String servicePath)
-
getTtl
@ManagedAttribute(description="The time to live (seconds)") public int getTtl()
-
setTtl
public void setTtl(int ttl)
-
getWatchTimeout
@ManagedAttribute(description="The watch timeout (seconds)") public int getWatchTimeout()
-
setWatchTimeout
public void setWatchTimeout(int watchTimeout)
-
isShouldStopConsumer
@ManagedAttribute(description="Whether to stop consumer when starting up and failed to become master") public boolean isShouldStopConsumer()
-
setShouldStopConsumer
public void setShouldStopConsumer(boolean shouldStopConsumer)
-
isLeader
@ManagedAttribute(description="Is this route the master or a slave") public boolean isLeader()
-
getClientUris
@ManagedAttribute(description="Etcd endpoints") public String getClientUris()
-
setClientUris
public void setClientUris(String clientUris)
-
onResponse
public void onResponse(mousio.client.promises.ResponsePromise<mousio.etcd4j.responses.EtcdKeysResponse> promise)
- Specified by:
onResponse
in interfacemousio.client.promises.ResponsePromise.IsSimplePromiseResponseHandler<mousio.etcd4j.responses.EtcdKeysResponse>
-
-