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
  • Constructor Details

    • SimpleEventSchedulerFactoryBean

      public SimpleEventSchedulerFactoryBean()
  • Method Details

    • getObject

      public SimpleEventScheduler getObject()
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean<SimpleEventScheduler>
    • getObjectType

      public Class<?> getObjectType()
      Specified by:
      getObjectType in interface org.springframework.beans.factory.FactoryBean<SimpleEventScheduler>
    • isSingleton

      public boolean isSingleton()
      Specified by:
      isSingleton in interface org.springframework.beans.factory.FactoryBean<SimpleEventScheduler>
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
    • setEventBus

      public void setEventBus(EventBus eventBus)
      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

      public void setExecutorService(ScheduledExecutorService executorService)
      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 a DefaultTransactionDefinition. 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:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException