it.netgrid.bauer.helpers.EventRecordingTopic Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bauer-api Show documentation
Show all versions of bauer-api Show documentation
Standard Topic-Based Messaging Facade for Java
package it.netgrid.bauer.helpers;
import java.util.Queue;
import it.netgrid.bauer.EventHandler;
import it.netgrid.bauer.Topic;
import it.netgrid.bauer.helpers.SubstituteTopicEvent.Action;
public class EventRecordingTopic implements Topic {
String name;
SubstituteTopic topic;
Queue eventQueue;
public EventRecordingTopic(SubstituteTopic topic, Queue eventQueue) {
this.topic = topic;
this.name = topic.getName();
this.eventQueue = eventQueue;
}
public String getName() {
return name;
}
@Override
public void addHandler(EventHandler handler) {
SubstituteTopicEvent qEvent = new SubstituteTopicEvent(topic, Action.ADD_HANDLER, null, handler);
this.eventQueue.add(qEvent);
}
@Override
public void post(E event) {
SubstituteTopicEvent qEvent = new SubstituteTopicEvent(topic, Action.POST, event, null);
this.eventQueue.add(qEvent);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy