org.axonframework.eventhandling.scheduling.java
Class SimpleEventSchedulerFactoryBean

java.lang.Object
  extended by org.axonframework.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 Summary
SimpleEventSchedulerFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 SimpleEventScheduler getObject()
           
 Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setEventBus(EventBus eventBus)
          Sets the eventBus that scheduled events should be published to.
 void setExecutorService(ScheduledExecutorService executorService)
          Sets the ExecutorService implementation that monitors the triggers and provides the Threads to publish events.
 void setTransactionDefinition(org.springframework.transaction.TransactionDefinition transactionDefinition)
          The TransactionDefinition to use by the transaction manager.
 void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
          Sets the transaction manager that manages the transaction around the publication of an event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleEventSchedulerFactoryBean

public SimpleEventSchedulerFactoryBean()
Method Detail

getObject

public SimpleEventScheduler getObject()
                               throws Exception
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean<SimpleEventScheduler>
Throws:
Exception

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()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
Exception

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(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException


Copyright © 2010-2016. All Rights Reserved.