io.github.qsy7.data.pipe.modules.event.bus.EventBusSource Maven / Gradle / Ivy
package io.github.qsy7.data.pipe.modules.event.bus;
import com.google.common.eventbus.Subscribe;
import io.github.qsy7.data.pipe.impl.AbstractSource;
import io.github.qsy7.data.pipe.impl.QueueIterator;
import io.github.qsy7.data.pipe.modules.event.bus.api.model.EventBusSourceConfiguration;
import java.io.Serializable;
import java.util.Iterator;
import java.util.concurrent.PriorityBlockingQueue;
/** TODO: 1. get the appropriate source connection here 2. get the appropriate source query here */
public class EventBusSource extends AbstractSource {
protected final PriorityBlockingQueue queue = new PriorityBlockingQueue();
protected final QueueIterator iterator = new QueueIterator(queue);
@Override
protected void doConfigure() {}
public void close() {}
@Subscribe
public void onMessage(Serializable data) {
queue.put(data);
}
@Override
public Iterator iterator() {
return iterator;
}
}