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

io.github.qsy7.data.pipe.modules.event.bus.EventBusSource Maven / Gradle / Ivy

There is a newer version: 0.3.4
Show newest version
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;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy