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 Details

    • ApplicationContextEventPublisher

      public ApplicationContextEventPublisher(SubscribableEventSource messageSource)
      Initialize the publisher to forward events received from the given messageSource to 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:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • convert

      protected org.springframework.context.ApplicationEvent convert(EventMessage eventMessage)
      Converts the given Axon eventMessage to a Spring ApplicationEvent. This method may be overridden to change the translation.

      The default implementation creates a PayloadApplicationEvent with 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:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean