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 class
ClusterActionServiceImpl.ClusterActionPubSub
PubSub to propagate an action to all nodes in the cluster.
-
Field Summary
Fields Modifier and Type Field Description protected ClusterActionServiceImpl.ClusterActionPubSub
clusterActionPubSub
protected Map<String,Consumer<ClusterActionMessage>>
clusterActions
static String
STREAM_START_CONSUMER_ACTION
static String
STREAM_START_PROCESSOR_ACTION
static String
STREAM_STOP_CONSUMER_ACTION
static String
STREAM_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 void
activate(ComponentContext context)
Activates the component.void
executeAction(ClusterActionMessage message)
Propagate an action to all others nodes in the cluster.protected Consumer<ClusterActionMessage>
getAction(String action)
int
getApplicationStartedOrder()
The component notification order forComponent.applicationStarted(org.nuxeo.runtime.model.ComponentContext)
.void
registerAction(String action, Consumer<ClusterActionMessage> consumer)
Registers an action for a requested propagationvoid
start(ComponentContext context)
Start the component.void
stop(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:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
start
public void start(ComponentContext context)
Description copied from interface:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
stop
public void stop(ComponentContext context) throws InterruptedException
Description copied from interface:Component
Stop the component.- Specified by:
stop
in interfaceComponent
- Overrides:
stop
in classDefaultComponent
- Throws:
InterruptedException
-
getApplicationStartedOrder
public int getApplicationStartedOrder()
Description copied from interface:Component
The 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:
getApplicationStartedOrder
in interfaceComponent
- Returns:
- the order, 1000 by default
-
registerAction
public void registerAction(String action, Consumer<ClusterActionMessage> consumer)
Description copied from interface:ClusterActionService
Registers an action for a requested propagation- Specified by:
registerAction
in interfaceClusterActionService
-
getAction
protected Consumer<ClusterActionMessage> getAction(String action)
-
executeAction
public void executeAction(ClusterActionMessage message)
Description copied from interface:ClusterActionService
Propagate an action to all others nodes in the cluster.- Specified by:
executeAction
in interfaceClusterActionService
-
-