org.axonframework.eventhandling
Class MultiplexingEventProcessingMonitor

java.lang.Object
  extended by org.axonframework.eventhandling.MultiplexingEventProcessingMonitor
All Implemented Interfaces:
EventProcessingMonitor

public class MultiplexingEventProcessingMonitor
extends Object
implements EventProcessingMonitor

Implementation of the EventProcessingMonitor that receives multiple invocations of downstream monitors and translates that to a single invocation to a target monitor.

This allows for multiple asynchronous executions to be reported in a single invocation to a monitor. Only when all downstream monitors report successful event handling, it will be reported as successful to the target monitor. When a failure is reported, it is reported to the target monitor as a failure as soon as all expected reports have been received.

Since:
2.1
Author:
Allard Buijze

Constructor Summary
MultiplexingEventProcessingMonitor(EventProcessingMonitor targetMonitor)
          Creates an instance with the given targetMonitor as the monitor to eventually forward calls to.
 
Method Summary
 void onEventProcessingCompleted(List<? extends EventMessage> eventMessages)
          Invoked when one or more events have been successfully processed by the instance it was subscribed to.
 void onEventProcessingFailed(List<? extends EventMessage> eventMessages, Throwable cause)
          Invoked when one or more events have failed processing by the instance it was subscribed to.
 void prepare(EventMessage eventMessage)
          Prepare the monitor for processing the given message.
 void prepareForInvocation(EventMessage eventMessage, EventListener member)
          Prepare the monitor for the invocation of the given message to the given member.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiplexingEventProcessingMonitor

public MultiplexingEventProcessingMonitor(EventProcessingMonitor targetMonitor)
Creates an instance with the given targetMonitor as the monitor to eventually forward calls to.

Parameters:
targetMonitor - The monitor to eventually forward calls to
Method Detail

prepare

public void prepare(EventMessage eventMessage)
Prepare the monitor for processing the given message. This means a tracker will be created to this event, which keeps track of the required and actual invocations.

When an unprepared message is acknowledged or reported as failed, that notification is immediately forwarded to the target monitor.

Parameters:
eventMessage - The event message to prepare for.

prepareForInvocation

public void prepareForInvocation(EventMessage eventMessage,
                                 EventListener member)
Prepare the monitor for the invocation of the given message to the given member. This means that, if the given member implement EventProcessingMonitorSupport, the monitor will wait for an invocation by that member's monitor.

It is important that this invocation happens before the actual invocation of the member.

Parameters:
eventMessage - The message about to be sent
member - The member that will be invoked
Throws:
IllegalArgumentException - if the given eventMessage has not been prepared yet.

onEventProcessingCompleted

public void onEventProcessingCompleted(List<? extends EventMessage> eventMessages)
Description copied from interface: EventProcessingMonitor
Invoked when one or more events have been successfully processed by the instance it was subscribed to.

Specified by:
onEventProcessingCompleted in interface EventProcessingMonitor
Parameters:
eventMessages - The messages that have been successfully processed

onEventProcessingFailed

public void onEventProcessingFailed(List<? extends EventMessage> eventMessages,
                                    Throwable cause)
Description copied from interface: EventProcessingMonitor
Invoked when one or more events have failed processing by the instance it was subscribed to.

Specified by:
onEventProcessingFailed in interface EventProcessingMonitor
Parameters:
eventMessages - The message that failed
cause - The cause of the failure


Copyright © 2010-2016. All Rights Reserved.