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 RetryHandlerbuildRetryHandler(NotificationStateRepository repository) Retrieve the list of lifecycle requirements that have been met.intgetPhase()booleanbooleanbooleanWhether the cluster service is already started.voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) voidsetLifecycleRequirementMet(RetryClusterServiceRequirementType requirementMet) Notify a retry cluster service instance that a particular lifecycle event has been met.voidsetStatusConsumers(List<Consumer<RetryHandlerStatus>> consumers) Set the list of consumers forRetryHandlerStatuson the cluster service.voidstart()Start the cluster service.voidstart(List<Consumer<RetryHandlerStatus>> consumers) Start the cluster service with a list of consumers for retry handler status eventsvoidstop()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:
isAutoStartupin interfaceorg.springframework.context.SmartLifecycle
-
stop
- Specified by:
stopin interfaceorg.springframework.context.SmartLifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
getPhase
public int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-
setBeanFactory
public void setBeanFactory(@NonNull org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware- Throws:
org.springframework.beans.BeansException
-
start
Description copied from interface:RetryClusterServiceStart the cluster service with a list of consumers for retry handler status events- Specified by:
startin interfaceRetryClusterService- Parameters:
consumers- consumers for retry handler status events. May be null.
-
start
public void start()Description copied from interface:RetryClusterServiceStart the cluster service.- Specified by:
startin interfaceorg.springframework.context.Lifecycle- Specified by:
startin interfaceRetryClusterService
-
isStarted
public boolean isStarted()Description copied from interface:RetryClusterServiceWhether the cluster service is already started.- Specified by:
isStartedin interfaceRetryClusterService- Returns:
- Whether the cluster service is already started.
-
stop
public void stop()Description copied from interface:RetryClusterServiceStop the node as a leader in the cluster.- Specified by:
stopin interfaceorg.springframework.context.Lifecycle- Specified by:
stopin interfaceRetryClusterService
-
setLifecycleRequirementMet
Description copied from interface:RetryClusterServiceNotify 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:
setLifecycleRequirementMetin interfaceRetryClusterService- Parameters:
requirementMet- The lifecycle requirement event that occurred.- See Also:
-
getLifecycleRequirementsMet
Description copied from interface:RetryClusterServiceRetrieve the list of lifecycle requirements that have been met.- Specified by:
getLifecycleRequirementsMetin interfaceRetryClusterService- Returns:
- The list of lifecycle requirements that have been met.
- See Also:
-
setStatusConsumers
Description copied from interface:RetryClusterServiceSet the list of consumers forRetryHandlerStatuson the cluster service.- Specified by:
setStatusConsumersin interfaceRetryClusterService- Parameters:
consumers- The list of status consumers
-
buildRetryHandler
-