@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 and Description |
---|
EtcdRoutePolicy() |
EtcdRoutePolicy(mousio.etcd4j.EtcdClient client) |
EtcdRoutePolicy(mousio.etcd4j.EtcdClient client,
boolean managedClient) |
EtcdRoutePolicy(EtcdConfiguration configuration) |
EtcdRoutePolicy(String clientUris) |
Modifier and Type | Method and 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) |
getExceptionHandler, handleException, onExchangeBegin, onExchangeDone, onRemove, onResume, resumeOrStartConsumer, resumeRoute, setExceptionHandler, startConsumer, startRoute, stopConsumer, stopRoute, stopRoute, stopRouteAsync, suspendOrStopConsumer, suspendRoute, suspendRoute
public EtcdRoutePolicy()
public EtcdRoutePolicy(EtcdConfiguration configuration) throws Exception
Exception
public EtcdRoutePolicy(mousio.etcd4j.EtcdClient client)
public EtcdRoutePolicy(mousio.etcd4j.EtcdClient client, boolean managedClient)
public EtcdRoutePolicy(String clientUris)
public org.apache.camel.CamelContext getCamelContext()
getCamelContext
in interface org.apache.camel.CamelContextAware
public void setCamelContext(org.apache.camel.CamelContext camelContext)
setCamelContext
in interface org.apache.camel.CamelContextAware
public void onInit(org.apache.camel.Route route)
onInit
in interface org.apache.camel.spi.RoutePolicy
onInit
in class org.apache.camel.support.RoutePolicySupport
public void onStart(org.apache.camel.Route route)
onStart
in interface org.apache.camel.spi.RoutePolicy
onStart
in class org.apache.camel.support.RoutePolicySupport
public void onStop(org.apache.camel.Route route)
onStop
in interface org.apache.camel.spi.RoutePolicy
onStop
in class org.apache.camel.support.RoutePolicySupport
public void onSuspend(org.apache.camel.Route route)
onSuspend
in interface org.apache.camel.spi.RoutePolicy
onSuspend
in class org.apache.camel.support.RoutePolicySupport
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.RoutePolicySupport
Exception
protected void doStop() throws Exception
doStop
in class org.apache.camel.support.RoutePolicySupport
Exception
protected void setLeader(boolean isLeader)
public mousio.etcd4j.EtcdClient getClient()
@ManagedAttribute(description="The route id") public String getRouteId()
@ManagedAttribute(description="The consumer endpoint", mask=true) public String getEndpointUrl()
public String getServiceName()
@ManagedAttribute(description="The etcd service name") public void setServiceName(String serviceName)
@ManagedAttribute(description="The etcd service path") public String getServicePath()
public void setServicePath(String servicePath)
@ManagedAttribute(description="The time to live (seconds)") public int getTtl()
public void setTtl(int ttl)
@ManagedAttribute(description="The watch timeout (seconds)") public int getWatchTimeout()
public void setWatchTimeout(int watchTimeout)
@ManagedAttribute(description="Whether to stop consumer when starting up and failed to become master") public boolean isShouldStopConsumer()
public void setShouldStopConsumer(boolean shouldStopConsumer)
@ManagedAttribute(description="Is this route the master or a slave") public boolean isLeader()
@ManagedAttribute(description="Etcd endpoints") public String getClientUris()
public void setClientUris(String clientUris)
public void onResponse(mousio.client.promises.ResponsePromise<mousio.etcd4j.responses.EtcdKeysResponse> promise)
onResponse
in interface mousio.client.promises.ResponsePromise.IsSimplePromiseResponseHandler<mousio.etcd4j.responses.EtcdKeysResponse>
Apache Camel