All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.terheyden.event.EventQuerySendSequentialStrategy Maven / Gradle / Ivy

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 eventRequest,
        Collection subscribers) {

        subscribers
            .stream()
            .map(sub -> (EventQuerySubscription) sub)
            .forEach(sub -> SendStrategies.sendQueryEventResponse(eventRequest, sub));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy