org.axonframework.integration.adapter
Class EventPublishingMessageChannelAdapter

java.lang.Object
  extended by org.axonframework.integration.adapter.EventPublishingMessageChannelAdapter
All Implemented Interfaces:
org.springframework.integration.core.MessageHandler

public class EventPublishingMessageChannelAdapter
extends Object
implements org.springframework.integration.core.MessageHandler

Adapter class that publishes Events from a Spring Integration 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:
0.4
Author:
Allard Buijze

Constructor Summary
EventPublishingMessageChannelAdapter(EventBus eventBus)
          Initialize the adapter to publish all incoming events to the given eventBus.
EventPublishingMessageChannelAdapter(EventBus eventBus, EventFilter filter)
          Initialize the adapter to publish all incoming events to the given eventBus if they accepted by the given filter.
 
Method Summary
 void handleMessage(org.springframework.integration.Message<?> message)
          Handles the given message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventPublishingMessageChannelAdapter

public EventPublishingMessageChannelAdapter(EventBus eventBus)
Initialize the adapter to publish all incoming events to the given eventBus.

Parameters:
eventBus - The event bus to publish events on

EventPublishingMessageChannelAdapter

public EventPublishingMessageChannelAdapter(EventBus eventBus,
                                            EventFilter filter)
Initialize the adapter to publish all incoming events to the given eventBus if they accepted by the given filter.

Parameters:
eventBus - The event bus to publish events on.
filter - The filter that indicates which events to publish.
Method Detail

handleMessage

public void handleMessage(org.springframework.integration.Message<?> message)
Handles the given message. The message is expected to contain an object of type EventMessage in its payload. If that is not the case, a MessageRejectedException is thrown.

If the message does contain an EventMessage, but the filter refuses it, a MessageRejectedException is also thrown.

Specified by:
handleMessage in interface org.springframework.integration.core.MessageHandler
Parameters:
message - The message containing the event to publish
Throws:
org.springframework.integration.MessageRejectedException - is the payload could not be published on the event bus.


Copyright © 2010-2016. All Rights Reserved.