Class ApplicationContextEventPublisher

java.lang.Object
org.axonframework.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 SubscribableMessageSource as Spring ApplicationEvent to the ApplicationContext.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ApplicationContextEventPublisher(org.axonframework.messaging.SubscribableMessageSource<? extends org.axonframework.eventhandling.EventMessage<?>> messageSource)
    Initialize the publisher to forward events received from the given messageSource to the application context that this bean is part of.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected org.springframework.context.ApplicationEvent
    convert(org.axonframework.eventhandling.EventMessage<?> eventMessage)
    Converts the given Axon eventMessage to a Spring ApplicationEvent.
    void
    setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ApplicationContextEventPublisher

      public ApplicationContextEventPublisher(org.axonframework.messaging.SubscribableMessageSource<? extends org.axonframework.eventhandling.EventMessage<?>> 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(org.axonframework.eventhandling.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