Class InboundEventMessageChannelAdapter

java.lang.Object
org.axonframework.spring.messaging.InboundEventMessageChannelAdapter
All Implemented Interfaces:
org.axonframework.messaging.SubscribableMessageSource<org.axonframework.eventhandling.EventMessage<?>>, org.springframework.messaging.MessageHandler

public class InboundEventMessageChannelAdapter extends Object implements org.springframework.messaging.MessageHandler, org.axonframework.messaging.SubscribableMessageSource<org.axonframework.eventhandling.EventMessage<?>>
Adapter class that publishes Events from a Spring Messaging Message Channel on the Event Bus. All events are expected to be contained in the payload of the Message instances.

Optionally, this adapter can be configured with a filter, which can block or accept messages based on their type.

Since:
3.0
Author:
Allard Buijze
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initialize the adapter to publish all incoming events to the subscribed processors.
    InboundEventMessageChannelAdapter(List<Consumer<List<? extends org.axonframework.eventhandling.EventMessage<?>>>> processors, EventMessageConverter eventMessageConverter)
    Initialize the adapter to publish all incoming events to the subscribed processors.
    InboundEventMessageChannelAdapter(org.axonframework.eventhandling.EventBus eventBus)
    Initialize an InboundEventMessageChannelAdapter instance that sends all incoming Event Messages to the given eventBus.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    handleMessage(org.springframework.messaging.Message<?> message)
    Handles the given message.
    org.axonframework.common.Registration
    subscribe(Consumer<List<? extends org.axonframework.eventhandling.EventMessage<?>>> messageProcessor)
     
    protected org.axonframework.eventhandling.EventMessage<?>
    transformMessage(org.springframework.messaging.Message<?> message)
    Transforms the given incoming Spring Messaging message to an Axon EventMessage.

    Methods inherited from class java.lang.Object

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

    • InboundEventMessageChannelAdapter

      public InboundEventMessageChannelAdapter()
      Initialize the adapter to publish all incoming events to the subscribed processors. Note that this instance should be registered as a consumer of a Spring Message Channel.
    • InboundEventMessageChannelAdapter

      public InboundEventMessageChannelAdapter(org.axonframework.eventhandling.EventBus eventBus)
      Initialize an InboundEventMessageChannelAdapter instance that sends all incoming Event Messages to the given eventBus. It is still possible for other Event Processors to subscribe to this MessageChannelAdapter.
      Parameters:
      eventBus - The EventBus instance for forward all messages to
    • InboundEventMessageChannelAdapter

      public InboundEventMessageChannelAdapter(List<Consumer<List<? extends org.axonframework.eventhandling.EventMessage<?>>>> processors, EventMessageConverter eventMessageConverter)
      Initialize the adapter to publish all incoming events to the subscribed processors. Note that this instance should be registered as a consumer of a Spring Message Channel.
      Parameters:
      processors - Processors to be subscribed
      eventMessageConverter - The message converter to use to convert spring message into event message
  • Method Details

    • subscribe

      @Nonnull public org.axonframework.common.Registration subscribe(@Nonnull Consumer<List<? extends org.axonframework.eventhandling.EventMessage<?>>> messageProcessor)
      Specified by:
      subscribe in interface org.axonframework.messaging.SubscribableMessageSource<org.axonframework.eventhandling.EventMessage<?>>
    • handleMessage

      public void handleMessage(@Nonnull org.springframework.messaging.Message<?> message)
      Handles the given message. If the filter refuses the message, it is ignored.
      Specified by:
      handleMessage in interface org.springframework.messaging.MessageHandler
      Parameters:
      message - The message containing the event to publish
    • transformMessage

      protected org.axonframework.eventhandling.EventMessage<?> transformMessage(org.springframework.messaging.Message<?> message)
      Transforms the given incoming Spring Messaging message to an Axon EventMessage. This method may be overridden to change how messages are translated between the two frameworks.
      Parameters:
      message - the Spring message to convert to an event
      Returns:
      an EventMessage from given Spring message