RocketMQ Streamer | Ignite Documentation

Ignite Summit 2025 – Call for Speakers Now Open – Learn more 

Edit

RocketMQ Streamer

This streamer module provides streaming from Apache RocketMQ to Ignite.

To use Ignite RocketMQ Streamer module

  1. Import it to your Maven project. If you are using Maven to manage dependencies of your project, you can add an Ignite RocketMQ module dependency like this (replace ${ignite-rocketmq-ext.version} with actual Ignite RocketMQ 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-rocketmq-ext</artifactId>
                <version>${ignite-rocketmq-ext.version}</version>
            </dependency>
            ...
        </dependencies>
        ...
    </project>
  2. Implement either StreamSingleTupleExtractor or StreamMultipleTupleExtractor for the streamer (shown as MyTupleExtractor in the code sample below). For a simple implementation, refer to RocketMQStreamerTest.java.

  3. Initialize and start the streamer

    IgniteDataStreamer<String, byte[]> dataStreamer = ignite.dataStreamer(MY_CACHE));
    
    dataStreamer.allowOverwrite(true);
    dataStreamer.autoFlushFrequency(10);
    
    streamer = new RocketMQStreamer<>();
    
    //configure.
    streamer.setIgnite(ignite);
    streamer.setStreamer(dataStreamer);
    streamer.setNameSrvAddr(NAMESERVER_IP_PORT);
    streamer.setConsumerGrp(CONSUMER_GRP);
    streamer.setTopic(TOPIC_NAME);
    streamer.setMultipleTupleExtractor(new MyTupleExtractor());
    
    streamer.start();
    
    ...
    
    // stop on shutdown
    streamer.stop();
    
    dataStreamer.close();

Refer to the Javadocs for more info on the available options.