Apache Flink Streamer | Ignite Documentation

Ignite Summit 2024 — Call For Speakers Now Open — Learn more

Edit

Apache Flink Streamer

Apache Ignite Flink Sink module is a streaming connector to inject Flink data into Ignite cache. The sink emits its input data to Ignite cache. When creating a sink, an Ignite cache name and Ignite grid configuration file have to be provided.

Starting data transfer to Ignite cache can be done with the following steps.

  1. Import Ignite Flink Sink Module in Maven Project If you are using Maven to manage dependencies of your project, you can add Flink module dependency like this (replace ${ignite-flink-ext.version} with actual Ignite Flink Extension version you are interested in):

    <project xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                            http://maven.apache.org/xsd/maven-4.0.0.xsd">
        ...
        <dependencies>
            ...
            <dependency>
                <groupId>org.apache.ignite</groupId>
                <artifactId>ignite-flink-ext</artifactId>
                <version>${ignite-flink-ext.version}</version>
            </dependency>
            ...
        </dependencies>
        ...
    </project>
  2. Create an Ignite configuration file and make sure it is accessible from the sink.

  3. Make sure your data input to the sink is specified and start the sink.

    IgniteSink igniteSink = new IgniteSink("myCache", "ignite.xml");
    
    igniteSink.setAllowOverwrite(true);
    igniteSink.setAutoFlushFrequency(10);
    igniteSink.start();
    
    DataStream<Map> stream = ...;
    
    // Sink data into the grid.
    stream.addSink(igniteSink);
    try {
        env.execute();
    } catch (Exception e){
        // Exception handling.
    }
    finally {
        igniteSink.stop();

Refer to the Javadocs of the ignite-flink module for more info on the available options.