Package org.nuxeo.runtime.pubsub
Class ClusterActionServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.runtime.pubsub.ClusterActionServiceImpl
-
- All Implemented Interfaces:
Adaptable,Component,Extensible,ClusterActionService,TimestampedService
public class ClusterActionServiceImpl extends DefaultComponent implements ClusterActionService
- Since:
- 2023.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classClusterActionServiceImpl.ClusterActionPubSubPubSub to propagate an action to all nodes in the cluster.
-
Field Summary
Fields Modifier and Type Field Description protected ClusterActionServiceImpl.ClusterActionPubSubclusterActionPubSubprotected Map<String,Consumer<ClusterActionMessage>>clusterActionsstatic StringSTREAM_START_CONSUMER_ACTIONstatic StringSTREAM_START_PROCESSOR_ACTIONstatic StringSTREAM_STOP_CONSUMER_ACTIONstatic StringSTREAM_STOP_PROCESSOR_ACTION-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description ClusterActionServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate(ComponentContext context)Activates the component.voidexecuteAction(ClusterActionMessage message)Propagate an action to all others nodes in the cluster.protected Consumer<ClusterActionMessage>getAction(String action)intgetApplicationStartedOrder()The component notification order forComponent.applicationStarted(org.nuxeo.runtime.model.ComponentContext).voidregisterAction(String action, Consumer<ClusterActionMessage> consumer)Registers an action for a requested propagationvoidstart(ComponentContext context)Start the component.voidstop(ComponentContext context)Stop the component.-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterContribution, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.pubsub.ClusterActionService
executeAction
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted
-
-
-
-
Field Detail
-
STREAM_START_PROCESSOR_ACTION
public static final String STREAM_START_PROCESSOR_ACTION
- See Also:
- Constant Field Values
-
STREAM_STOP_PROCESSOR_ACTION
public static final String STREAM_STOP_PROCESSOR_ACTION
- See Also:
- Constant Field Values
-
STREAM_START_CONSUMER_ACTION
public static final String STREAM_START_CONSUMER_ACTION
- See Also:
- Constant Field Values
-
STREAM_STOP_CONSUMER_ACTION
public static final String STREAM_STOP_CONSUMER_ACTION
- See Also:
- Constant Field Values
-
clusterActions
protected final Map<String,Consumer<ClusterActionMessage>> clusterActions
-
clusterActionPubSub
protected ClusterActionServiceImpl.ClusterActionPubSub clusterActionPubSub
-
-
Method Detail
-
activate
public void activate(ComponentContext context)
Description copied from interface:ComponentActivates the component.This method is called by the runtime when a component is activated.
- Specified by:
activatein interfaceComponent- Overrides:
activatein classDefaultComponent- Parameters:
context- the runtime context
-
start
public void start(ComponentContext context)
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-
stop
public void stop(ComponentContext context) throws InterruptedException
Description copied from interface:ComponentStop the component.- Specified by:
stopin interfaceComponent- Overrides:
stopin classDefaultComponent- Throws:
InterruptedException
-
getApplicationStartedOrder
public int getApplicationStartedOrder()
Description copied from interface:ComponentThe component notification order forComponent.applicationStarted(org.nuxeo.runtime.model.ComponentContext).Components are notified in increasing order. Order 1000 is the default order for components that don't care. Order 100 is the repository initialization.
- Specified by:
getApplicationStartedOrderin interfaceComponent- Returns:
- the order, 1000 by default
-
registerAction
public void registerAction(String action, Consumer<ClusterActionMessage> consumer)
Description copied from interface:ClusterActionServiceRegisters an action for a requested propagation- Specified by:
registerActionin interfaceClusterActionService
-
getAction
protected Consumer<ClusterActionMessage> getAction(String action)
-
executeAction
public void executeAction(ClusterActionMessage message)
Description copied from interface:ClusterActionServicePropagate an action to all others nodes in the cluster.- Specified by:
executeActionin interfaceClusterActionService
-
-