Ejemplo n.º 1
0
  @Override
  public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
    initialized = false;
    // Spout internals
    this.collector = collector;
    this.topologyContext = context;
    maxRetries = kafkaSpoutConfig.getMaxTupleRetries();
    numUncommittedOffsets = 0;

    // Offset management
    firstPollOffsetStrategy = kafkaSpoutConfig.getFirstPollOffsetStrategy();
    consumerAutoCommitMode = kafkaSpoutConfig.isConsumerAutoCommitMode();

    // Retries management
    retryService = kafkaSpoutConfig.getRetryService();

    // Tuples builder delegate
    tuplesBuilder = kafkaSpoutConfig.getTuplesBuilder();

    if (!consumerAutoCommitMode) { // If it is auto commit, no need to commit offsets manually
      commitTimer =
          new Timer(500, kafkaSpoutConfig.getOffsetsCommitPeriodMs(), TimeUnit.MILLISECONDS);
    }

    acked = new HashMap<>();
    emitted = new HashSet<>();
    waitingToEmit = Collections.emptyListIterator();

    LOG.info("Kafka Spout opened with the following configuration: {}", kafkaSpoutConfig);
  }
Ejemplo n.º 2
0
 @Override
 public Iterator<PlayerQueue.Entry> iterator() {
   return Collections.emptyListIterator();
 }