Tabnine Logo
org.apache.flink.streaming.api.functions.source
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.flink.streaming.api.functions.source

Best Java code snippets using org.apache.flink.streaming.api.functions.source (Showing top 20 results out of 540)

origin: apache/flink

/**
 * Sets the state of the split to {@code null}.
 */
public void resetSplitState() {
  this.setSplitState(null);
}
origin: apache/flink

  @Override
  public String toString() {
    return "[" + getSplitNumber() + "] " + getPath() + " mod@ " +
      modificationTime + " : " + getStart() + " + " + getLength();
  }
}
origin: apache/flink

public void cancel() {
  // important: marking the source as stopped has to happen before the function is stopped.
  // the flag that tracks this status is volatile, so the memory model also guarantees
  // the happens-before relationship
  markCanceledOrStopped();
  userFunction.cancel();
  // the context may not be initialized if the source was never running.
  if (ctx != null) {
    ctx.close();
  }
}
origin: apache/flink

@Override
public void run(SourceContext<String> ctx) throws Exception {
  while (running) {
    ctx.collect("hello");
  }
}
origin: apache/flink

@Override
public void run(SourceContext<Tuple2<Integer, Long>> ctx) throws Exception {
  Object lock = ctx.getCheckpointLock();
  while (count < NUM_INPUT){
    synchronized (lock){
      for (int i = 0; i < PARALLELISM; i++) {
        ctx.collect(Tuple2.of(i, count + 1));
      }
      count++;
    }
  }
}
origin: apache/flink

@Override
public void close() throws Exception {
  super.close();
  client.close();
}
origin: apache/flink

@Override
public void open(Configuration parameters) throws Exception {
  super.open(parameters);
  running = true;
}
origin: apache/flink

public void run(SourceContext<Object> ctx) throws Exception {
  try {
    this.fun.run(ctx);
  } catch (PyException pe) {
    throw createAndLogException(pe);
  }
}
origin: apache/flink

@Override
public void open(Configuration parameters) throws Exception {
  super.open(parameters);
}
origin: apache/flink

@Override
public InputSplit next() {
  if (this.nextSplit == null && !hasNext()) {
    throw new NoSuchElementException();
  }
  final InputSplit tmp = this.nextSplit;
  this.nextSplit = null;
  return tmp;
}
origin: apache/flink

public void cancel() {
  synchronized (sync) {
    canceled = true;
    socketSource.cancel();
    interrupt();
  }
}
origin: apache/flink

  @Override
  public void run() {
    try {
      source.run(ctx);
    }
    catch (Throwable t) {
      error[0] = t;
    }
  }
};
origin: apache/flink

  public void waitUntilDone() throws InterruptedException {
    join();
    if (error != null) {
      throw new RuntimeException("Error in source thread", error);
    }
  }
}
origin: apache/flink

@Override
public void setRuntimeContext(RuntimeContext t) {
  ACTUAL_ORDER_TRACKING.add("UDF::setRuntimeContext");
  super.setRuntimeContext(t);
}
origin: apache/flink

@Override
public void run(SourceContext<Integer> ctx) throws Exception {
  for (int i = 0; i < numWatermarks; i++) {
    ctx.collect(i);
  }
}
origin: apache/flink

@Override
public void open(Configuration parameters) throws Exception {
  super.open(parameters);
  client = new SiteToSiteClient.Builder().fromConfig(clientConfig).build();
}
origin: apache/flink

@Override
public void run(SourceContext<Integer> collector) throws Exception {
  while (counter < 8200) {
    collector.collect(getTrainingData());
  }
}
origin: apache/flink

@Override
public void run(SourceContext<String> ctx) throws Exception {
  if (!openCalled) {
    Assert.fail("Open was not called before run.");
  }
  for (int i = 0; i < 10; i++) {
    ctx.collect("Hello" + i);
  }
}
origin: apache/flink

@Override
public void run(SourceContext<Tuple2<String, Integer>> ctx) throws Exception {
  ctx.collect(Tuple2.of("a", 0));
  ctx.collect(Tuple2.of("a", 1));
  ctx.collect(Tuple2.of("b", 3));
  ctx.collect(Tuple2.of("c", 6));
  ctx.collect(Tuple2.of("c", 7));
  ctx.collect(Tuple2.of("c", 8));
  // source is finite, so it will have an implicit MAX watermark when it finishes
}
origin: apache/flink

@Override
public void run(SourceContext<Tuple3<String, String, Integer>> ctx) throws Exception {
  ctx.collect(Tuple3.of("a", "x", 0));
  ctx.collect(Tuple3.of("a", "y", 1));
  ctx.collect(Tuple3.of("a", "z", 2));
  ctx.collect(Tuple3.of("b", "u", 3));
  ctx.collect(Tuple3.of("b", "w", 5));
  ctx.collect(Tuple3.of("a", "i", 6));
  ctx.collect(Tuple3.of("a", "j", 7));
  ctx.collect(Tuple3.of("a", "k", 8));
  // source is finite, so it will have an implicit MAX watermark when it finishes
}
org.apache.flink.streaming.api.functions.source

Most used classes

  • SourceFunction$SourceContext
    Interface that source functions use to emit elements, and possibly watermarks.
  • RichParallelSourceFunction
    Base class for implementing a parallel data source. Upon execution, the runtime will execute as many
  • RichSourceFunction
    Base class for implementing a parallel data source that has access to context information (via #getR
  • FromElementsFunction
    A stream source function that returns a sequence of elements.Upon construction, this source function
  • MessageAcknowledgingSourceBase
    Abstract base class for data sources that receive elements from a message queue and acknowledge them
  • ContinuousFileReaderOperator,
  • FileMonitoringFunction,
  • InputFormatSourceFunction,
  • SourceFunction,
  • StatefulSequenceSource,
  • TimestampedFileInputSplit,
  • ContinuousFileMonitoringFunction,
  • FileProcessingMode,
  • FileReadFunction,
  • FromIteratorFunction,
  • FromSplittableIteratorFunction,
  • MultipleIdsMessageAcknowledgingSourceBase,
  • ContinuousFileReaderOperator$SplitReader,
  • InputFormatSourceFunction$1
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now