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

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

The newest version!
package com.terheyden.event;

import java.util.Collection;

/**
 * Combines an event obj with an event key, for queuing and delivery.
 */
class PublishRequest {

    private final EventRequest eventRequest;
    private final SendEventStrategy sendEventStrategy;
    private final Collection subscribers;

    PublishRequest(
        EventRequest eventRequest,
        SendEventStrategy sendEventStrategy,
        Collection subscribers) {

        this.eventRequest = eventRequest;
        this.sendEventStrategy = sendEventStrategy;
        this.subscribers = subscribers;
    }

    EventRequest eventRequest() {
        return eventRequest;
    }

    SendEventStrategy eventPublisher() {
        return sendEventStrategy;
    }

    Collection subscribers() {
        return subscribers;
    }

    @Override
    public String toString() {
        return String.format("PublishRequest [%s]; %d subs => %s",
            eventRequest(),
            subscribers().size(),
            eventPublisher().getClass().getSimpleName());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy