Package org.apache.camel.cluster
Interface CamelClusterService
-
- All Superinterfaces:
AutoCloseable,CamelContextAware,HasId,IdAware,Ordered,Service
- All Known Subinterfaces:
CamelPreemptiveClusterService
public interface CamelClusterService extends Service, CamelContextAware, IdAware, Ordered
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceCamelClusterService.Selector
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Map<String,Object>getAttributes()Attributes associated to the service.Collection<String>getNamespaces()Return the namespaces handled by this service.default intgetOrder()Gets the order.CamelClusterViewgetView(String namespace)Get a view of the cluster bound to a namespace creating it if needed.booleanisLeader(String namespace)Check if the service is the leader on the given namespace.voidreleaseView(CamelClusterView view)Release a view if it has no references.voidstartView(String namespace)Force start of the view associated to the give namespace.voidstopView(String namespace)Force stop of the view associated to the give namespace.default <T extends CamelClusterService>
Tunwrap(Class<T> clazz)Access the underlying concrete CamelClusterService implementation to provide access to further features.-
Methods inherited from interface org.apache.camel.CamelContextAware
getCamelContext, setCamelContext
-
Methods inherited from interface org.apache.camel.spi.IdAware
setGeneratedId, setId
-
-
-
-
Method Detail
-
getOrder
default int getOrder()
Description copied from interface:OrderedGets the order. Use low numbers for higher priority. Normally the sorting will start from 0 and move upwards. So if you want to be last then useInteger.MAX_VALUEor egOrdered.LOWEST.
-
getView
CamelClusterView getView(String namespace) throws Exception
Get a view of the cluster bound to a namespace creating it if needed. Multiple calls to this method with the same namespace should return the same instance. The instance is automatically started the first time it is instantiated and if the cluster service is ready.- Parameters:
namespace- the namespace the view refer to.- Returns:
- the view.
- Throws:
Exception- if the view can't be created.
-
releaseView
void releaseView(CamelClusterView view) throws Exception
Release a view if it has no references.- Parameters:
view- the view.- Throws:
Exception
-
getNamespaces
Collection<String> getNamespaces()
Return the namespaces handled by this service.
-
startView
void startView(String namespace) throws Exception
Force start of the view associated to the give namespace.- Throws:
Exception
-
stopView
void stopView(String namespace) throws Exception
Force stop of the view associated to the give namespace.- Throws:
Exception
-
isLeader
boolean isLeader(String namespace)
Check if the service is the leader on the given namespace.- Parameters:
namespace- the namespace.
-
unwrap
default <T extends CamelClusterService> T unwrap(Class<T> clazz)
Access the underlying concrete CamelClusterService implementation to provide access to further features.- Parameters:
clazz- the proprietary class or interface of the underlying concrete CamelClusterService.- Returns:
- an instance of the underlying concrete CamelClusterService as the required type.
-
-