use of org.apache.flink.streaming.connectors.nifi.StandardNiFiDataPacket in project flink by apache.
the class NiFiSinkTopologyExample method main.
public static void main(String[] args) throws Exception {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
SiteToSiteClientConfig clientConfig = new SiteToSiteClient.Builder().url("http://localhost:8080/nifi").portName("Data from Flink").buildConfig();
DataStreamSink<String> dataStream = env.fromElements("one", "two", "three", "four", "five", "q").addSink(new NiFiSink<>(clientConfig, new NiFiDataPacketBuilder<String>() {
@Override
public NiFiDataPacket createNiFiDataPacket(String s, RuntimeContext ctx) {
return new StandardNiFiDataPacket(s.getBytes(ConfigConstants.DEFAULT_CHARSET), new HashMap<String, String>());
}
}));
env.execute();
}
Aggregations