Class Function
- java.lang.Object
-
- io.github.punchplatform.api.punchline.Node
-
- io.github.punchplatform.api.punchline.java.Function
-
public abstract class Function extends Node
Functions can be used for implementing processing or sink nodes.By inheriting this class, you have access to the following class fields:
- Author:
- dimi
-
-
Field Summary
Fields Modifier and Type Field Description protected MetricContextmetricContextThe metric context to create prometheus gauges, histograms and counters.protected StringpersistentIdA persistent identifier.-
Fields inherited from class io.github.punchplatform.api.punchline.Node
engineSettings, exitConditions, id, kind, load_control, out, punchline, settings, taskId, type
-
-
Constructor Summary
Constructors Constructor Description Function()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidack(Row row)Ack a row.abstract voidexecute(Row row)Implement this method to prepare yourself.voidfail(Row row)Fail a rowvoidinsert(Out out, Row anchor, List<Object> columnValues)Insert a new row into an output.voidinsert(List<Out> outs, Row anchor, List<Object> columnValues)Dispatch rows towards several destinations.abstract voidopen()Implement this method to prepare yourself.voidsetMetricContext(MetricContext metricContext)voidsetPersistentId(String persistentId)voidsetTableCollector(FunctionTableCollector tableCollector)Setter to make it clearer to source implementor to not refer directly to the collector.
-
-
-
Field Detail
-
metricContext
protected MetricContext metricContext
The metric context to create prometheus gauges, histograms and counters.
-
persistentId
protected String persistentId
A persistent identifier. This identifier will be the same after a restart.
-
-
Method Detail
-
execute
public abstract void execute(Row row)
Implement this method to prepare yourself. As a source, as a function or as a sink you may have to set up some context.In case of problem, throw a RuntimeException. This will interrupt the punchline and will make it exit with error code 1.
- Parameters:
row- the input row
-
open
public abstract void open() throws IOException, ConfigurationExceptionImplement this method to prepare yourself. As a source, as a function or as a sink you may have to set up some context.- Throws:
IOExceptionConfigurationException
-
insert
public final void insert(Out out, Row anchor, List<Object> columnValues)
Insert a new row into an output.- Parameters:
out- the outputanchor- the anchored row.columnValues- the list of column values
-
insert
public final void insert(List<Out> outs, Row anchor, List<Object> columnValues)
Dispatch rows towards several destinations.- Parameters:
outs- the outputanchor- the anchored row.columnValues- the list of column values
-
ack
public final void ack(Row row)
Ack a row.- Parameters:
row- the row
-
fail
public final void fail(Row row)
Fail a row- Parameters:
row- the row
-
setTableCollector
public void setTableCollector(FunctionTableCollector tableCollector)
Setter to make it clearer to source implementor to not refer directly to the collector.- Parameters:
tableCollector- collector to use
-
setPersistentId
public void setPersistentId(String persistentId)
-
setMetricContext
public void setMetricContext(MetricContext metricContext)
-
-