com.terheyden.event.PublishRequest 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;
/**
* 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());
}
}