com.terheyden.event.EventQuerySendSequentialStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of event-router Show documentation
Show all versions of event-router Show documentation
Simple, fast, flexible event router / event bus for Java
The newest version!
package com.terheyden.event;
import java.util.Collection;
/**
* Publishes events to subscribers in order, on the calling thread.
*/
class EventQuerySendSequentialStrategy extends ExceptionHandlingSendEventStrategy {
EventQuerySendSequentialStrategy(SubscriberExceptionHandler exceptionHandler) {
super(exceptionHandler);
}
@Override
@SuppressWarnings("unchecked")
public void sendEventToSubscribers(
EventRequest extends I> eventRequest,
Collection extends EventSubscription> subscribers) {
subscribers
.stream()
.map(sub -> (EventQuerySubscription) sub)
.forEach(sub -> SendStrategies.sendQueryEventResponse(eventRequest, sub));
}
}