Package org.apache.camel.support.cluster
Class RebalancingCamelClusterService
java.lang.Object
org.apache.camel.support.cluster.RebalancingCamelClusterService
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.cluster.CamelClusterService,org.apache.camel.cluster.CamelPreemptiveClusterService,org.apache.camel.Ordered,org.apache.camel.Service,org.apache.camel.spi.HasCamelContext,org.apache.camel.spi.HasId,org.apache.camel.spi.IdAware
public class RebalancingCamelClusterService
extends Object
implements org.apache.camel.cluster.CamelPreemptiveClusterService
A
RebalancingCamelClusterService adds rebalancing capabilities to an underlying
CamelPreemptiveClusterService. Each view is treated as a partition by this cluster service and it makes sure
that all services belonging to the cluster own a balanced number of partitions (same number or difference at most 1
when not possible).-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.camel.cluster.CamelClusterService
org.apache.camel.cluster.CamelClusterService.Selector -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.camel.CamelContextprotected org.apache.camel.cluster.CamelPreemptiveClusterServiceprotected final longprotected ScheduledExecutorServiceFields inherited from interface org.apache.camel.Ordered
HIGHEST, LOWEST -
Constructor Summary
ConstructorsConstructorDescriptionRebalancingCamelClusterService(org.apache.camel.CamelContext camelContext, org.apache.camel.cluster.CamelPreemptiveClusterService delegate, long periodMillis) RebalancingCamelClusterService(org.apache.camel.cluster.CamelPreemptiveClusterService delegate, long periodMillis) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.CamelContextorg.apache.camel.cluster.CamelPreemptiveClusterServicegetId()longorg.apache.camel.cluster.CamelPreemptiveClusterViewbooleanprotected Integermembers()protected voidrebalanceGroup(List<String> partitions, int quota) protected voidvoidreleaseView(org.apache.camel.cluster.CamelClusterView view) voidsetCamelContext(org.apache.camel.CamelContext camelContext) voidsetDelegate(org.apache.camel.cluster.CamelPreemptiveClusterService delegate) protected voidsetDisabled(String partition, boolean disabled) voidvoidstart()voidvoidstop()voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.cluster.CamelClusterService
getAttributes, getOrder, unwrapMethods inherited from interface org.apache.camel.spi.IdAware
setGeneratedIdMethods inherited from interface org.apache.camel.Service
build, close, init
-
Field Details
-
serializedExecutor
-
delegate
protected org.apache.camel.cluster.CamelPreemptiveClusterService delegate -
camelContext
protected org.apache.camel.CamelContext camelContext -
periodMillis
protected final long periodMillis
-
-
Constructor Details
-
RebalancingCamelClusterService
public RebalancingCamelClusterService(org.apache.camel.cluster.CamelPreemptiveClusterService delegate, long periodMillis) -
RebalancingCamelClusterService
public RebalancingCamelClusterService(org.apache.camel.CamelContext camelContext, org.apache.camel.cluster.CamelPreemptiveClusterService delegate, long periodMillis)
-
-
Method Details
-
start
public void start()- Specified by:
startin interfaceorg.apache.camel.Service
-
stop
public void stop()- Specified by:
stopin interfaceorg.apache.camel.Service
-
getDelegate
public org.apache.camel.cluster.CamelPreemptiveClusterService getDelegate() -
getPeriodMillis
public long getPeriodMillis() -
setDelegate
public void setDelegate(org.apache.camel.cluster.CamelPreemptiveClusterService delegate) -
reconcile
protected void reconcile() -
rebalanceGroup
-
setDisabled
-
owned
-
partitionList
-
members
-
getView
public org.apache.camel.cluster.CamelPreemptiveClusterView getView(String namespace) throws Exception - Specified by:
getViewin interfaceorg.apache.camel.cluster.CamelClusterService- Specified by:
getViewin interfaceorg.apache.camel.cluster.CamelPreemptiveClusterService- Throws:
Exception
-
releaseView
- Specified by:
releaseViewin interfaceorg.apache.camel.cluster.CamelClusterService- Throws:
Exception
-
getNamespaces
- Specified by:
getNamespacesin interfaceorg.apache.camel.cluster.CamelClusterService
-
startView
- Specified by:
startViewin interfaceorg.apache.camel.cluster.CamelClusterService- Throws:
Exception
-
stopView
- Specified by:
stopViewin interfaceorg.apache.camel.cluster.CamelClusterService- Throws:
Exception
-
isLeader
- Specified by:
isLeaderin interfaceorg.apache.camel.cluster.CamelClusterService
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext) - Specified by:
setCamelContextin interfaceorg.apache.camel.CamelContextAware
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()- Specified by:
getCamelContextin interfaceorg.apache.camel.spi.HasCamelContext
-
setId
- Specified by:
setIdin interfaceorg.apache.camel.spi.IdAware
-
getId
- Specified by:
getIdin interfaceorg.apache.camel.spi.HasId
-