Class DefaultRetryClusterService
java.lang.Object
com.broadleafcommerce.common.messaging.notification.DefaultRetryClusterService
- All Implemented Interfaces:
RetryClusterService
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.context.Lifecycle
,org.springframework.context.Phased
,org.springframework.context.SmartLifecycle
public class DefaultRetryClusterService
extends Object
implements RetryClusterService, org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.SmartLifecycle
- Author:
- Jeff Fischer
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultRetryClusterService
(List<NotificationStateRepository> repositories, NotificationHandler notificationHandler, DurableNotificationProperties properties, String messageType, List<IgnoredNotificationStateRepository> ignoredRepositories, com.broadleafcommerce.common.extension.data.DataRouteReference reference) -
Method Summary
Modifier and TypeMethodDescriptionprotected RetryHandler
buildRetryHandler
(NotificationStateRepository repository) Retrieve the list of lifecycle requirements that have been met.int
getPhase()
boolean
boolean
boolean
Whether the cluster service is already started.void
setBeanFactory
(org.springframework.beans.factory.BeanFactory beanFactory) void
setLifecycleRequirementMet
(RetryClusterServiceRequirementType requirementMet) Notify a retry cluster service instance that a particular lifecycle event has been met.void
setStatusConsumers
(List<Consumer<RetryHandlerStatus>> consumers) Set the list of consumers forRetryHandlerStatus
on the cluster service.void
start()
Start the cluster service.void
start
(List<Consumer<RetryHandlerStatus>> consumers) Start the cluster service with a list of consumers for retry handler status eventsvoid
stop()
Stop the node as a leader in the cluster.void
-
Constructor Details
-
DefaultRetryClusterService
public DefaultRetryClusterService(List<NotificationStateRepository> repositories, NotificationHandler notificationHandler, DurableNotificationProperties properties, String messageType, List<IgnoredNotificationStateRepository> ignoredRepositories, com.broadleafcommerce.common.extension.data.DataRouteReference reference)
-
-
Method Details
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceorg.springframework.context.SmartLifecycle
-
stop
- Specified by:
stop
in interfaceorg.springframework.context.SmartLifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
-
getPhase
public int getPhase()- Specified by:
getPhase
in interfaceorg.springframework.context.Phased
- Specified by:
getPhase
in interfaceorg.springframework.context.SmartLifecycle
-
setBeanFactory
public void setBeanFactory(@NonNull org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
- Throws:
org.springframework.beans.BeansException
-
start
Description copied from interface:RetryClusterService
Start the cluster service with a list of consumers for retry handler status events- Specified by:
start
in interfaceRetryClusterService
- Parameters:
consumers
- consumers for retry handler status events. May be null.
-
start
public void start()Description copied from interface:RetryClusterService
Start the cluster service.- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
- Specified by:
start
in interfaceRetryClusterService
-
isStarted
public boolean isStarted()Description copied from interface:RetryClusterService
Whether the cluster service is already started.- Specified by:
isStarted
in interfaceRetryClusterService
- Returns:
- Whether the cluster service is already started.
-
stop
public void stop()Description copied from interface:RetryClusterService
Stop the node as a leader in the cluster.- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
- Specified by:
stop
in interfaceRetryClusterService
-
setLifecycleRequirementMet
Description copied from interface:RetryClusterService
Notify a retry cluster service instance that a particular lifecycle event has been met. If all requirements are met, the cluster service is started. Note, any calls toRetryClusterService.start(List)
orRetryClusterService.start()
will immediately start the service, regardless if the prerequisites are met.- Specified by:
setLifecycleRequirementMet
in interfaceRetryClusterService
- Parameters:
requirementMet
- The lifecycle requirement event that occurred.- See Also:
-
getLifecycleRequirementsMet
Description copied from interface:RetryClusterService
Retrieve the list of lifecycle requirements that have been met.- Specified by:
getLifecycleRequirementsMet
in interfaceRetryClusterService
- Returns:
- The list of lifecycle requirements that have been met.
- See Also:
-
setStatusConsumers
Description copied from interface:RetryClusterService
Set the list of consumers forRetryHandlerStatus
on the cluster service.- Specified by:
setStatusConsumers
in interfaceRetryClusterService
- Parameters:
consumers
- The list of status consumers
-
buildRetryHandler
-