Class SimpleEventSchedulerFactoryBean
java.lang.Object
org.axonframework.spring.eventhandling.scheduling.java.SimpleEventSchedulerFactoryBean
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.FactoryBean<SimpleEventScheduler>,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
public class SimpleEventSchedulerFactoryBean
extends Object
implements org.springframework.beans.factory.FactoryBean<SimpleEventScheduler>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationContextAware
Spring FactoryBean that creates a SimpleEventScheduler instance using resources found in the Spring Application
Context. The SimpleEventScheduler uses Java's ScheduledExecutorService as scheduling and triggering mechanism.
Note that this mechanism is non-persistent. Scheduled tasks will be lost when the JVM is shut down, unless special
measures have been taken to prevent that. For more flexible and powerful scheduling options, see
QuartzEventScheduler.- Since:
- 1.1
- Author:
- Allard Buijze
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddestroy()Class<?> booleanvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetEventBus(EventBus eventBus) Sets the eventBus that scheduled events should be published to.voidsetExecutorService(ScheduledExecutorService executorService) Sets the ExecutorService implementation that monitors the triggers and provides the Threads to publish events.voidsetTransactionDefinition(org.springframework.transaction.TransactionDefinition transactionDefinition) The TransactionDefinition to use by the transaction manager.voidsetTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) Sets the transaction manager that manages the transaction around the publication of an event.
-
Constructor Details
-
SimpleEventSchedulerFactoryBean
public SimpleEventSchedulerFactoryBean()
-
-
Method Details
-
getObject
- Specified by:
getObjectin interfaceorg.springframework.beans.factory.FactoryBean<SimpleEventScheduler>
-
getObjectType
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean<SimpleEventScheduler>
-
isSingleton
public boolean isSingleton()- Specified by:
isSingletonin interfaceorg.springframework.beans.factory.FactoryBean<SimpleEventScheduler>
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
setEventBus
Sets the eventBus that scheduled events should be published to. Defaults to the EventBus found in the application context. If there is more than one EventBus in the application context, you must specify which one to use.- Parameters:
eventBus- The EventBus to publish scheduled events to
-
setExecutorService
Sets the ExecutorService implementation that monitors the triggers and provides the Threads to publish events. Defaults to a single-threaded executor.- Parameters:
executorService- The executor service providing the scheduling and execution resources
-
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) Sets the transaction manager that manages the transaction around the publication of an event. If a transaction manager is not specified, no transactions are managed around the event publication.- Parameters:
transactionManager- the transaction manager that takes care of transactions around event publication
-
setTransactionDefinition
public void setTransactionDefinition(org.springframework.transaction.TransactionDefinition transactionDefinition) The TransactionDefinition to use by the transaction manager. Defaults to aDefaultTransactionDefinition. Is ignored if no transaction manager is configured.- Parameters:
transactionDefinition- the TransactionDefinition to use by the transaction manager
-
setApplicationContext
public void setApplicationContext(@Nonnull org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-