ZeroMQ Streamer | Ignite Documentation

Ignite Summit Europe—November 2022—Call For Speakers Is Now Open!

Edit

ZeroMQ Streamer

Apache Ignite ZeroMQ Streamer module enables streaming capabilities via ZeroMQ into Ignite.

To start streaming into Ignite, you need to do the following:

  1. Add Ignite ZeroMQ Streamer Module to your Maven pom.xml file.

    <dependencies>
        ...
        <dependency>
            <groupId>org.apache.ignite</groupId>
            <artifactId>ignite-zeromq-ext</artifactId>
            <version>${ignite-zeromq-ext.version}</version>
        </dependency>
        ...
    </dependencies>
  2. Implement either the StreamSingleTupleExtractor or the StreamMultipleTupleExtractor for ZeroMQ streamer. Refer to this sample implementation for more details.

  3. Set the extractor and initiate the streaming as shown below:

    try (IgniteDataStreamer<Integer, String> dataStreamer =
         grid().dataStreamer("myCacheName")) {
    
        dataStreamer.allowOverwrite(true);
        dataStreamer.autoFlushFrequency(1);
    
        try (IgniteZeroMqStreamer streamer = new IgniteZeroMqStreamer(
          1, ZeroMqTypeSocket.PULL, "tcp://localhost:5671", null)) {
          streamer.setIgnite(grid());
          streamer.setStreamer(dataStreamer);
    
          streamer.setSingleTupleExtractor(new ZeroMqStringSingleTupleExtractor());
    
          streamer.start();
        }
    }