Class ApplicationContextEventPublisher
java.lang.Object
org.axonframework.extension.spring.messaging.ApplicationContextEventPublisher
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
public class ApplicationContextEventPublisher
extends Object
implements org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware
Component that forward events received from a
SubscribableEventSource as Spring ApplicationEvent to
the ApplicationContext.-
Constructor Summary
ConstructorsConstructorDescriptionApplicationContextEventPublisher(SubscribableEventSource messageSource) Initialize the publisher to forward events received from the givenmessageSourceto the application context that this bean is part of. -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected org.springframework.context.ApplicationEventconvert(EventMessage eventMessage) Converts the given AxoneventMessageto a Spring ApplicationEvent.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
Constructor Details
-
ApplicationContextEventPublisher
Initialize the publisher to forward events received from the givenmessageSourceto the application context that this bean is part of.- Parameters:
messageSource- The source to subscribe to.
-
-
Method Details
-
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
-
convert
Converts the given AxoneventMessageto a Spring ApplicationEvent. This method may be overridden to change the translation.The default implementation creates a
PayloadApplicationEventwith the Message's payload.If this method returns
null, no message is published- Parameters:
eventMessage- The EventMessage to transform- Returns:
- the Spring ApplicationEvent representing the Axon EventMessage
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-