RocketMQ Streamer
This streamer module provides streaming from Apache RocketMQ to Ignite.
To use Ignite RocketMQ Streamer module
-
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>
-
Implement either
StreamSingleTupleExtractor
orStreamMultipleTupleExtractor
for the streamer (shown asMyTupleExtractor
in the code sample below). For a simple implementation, refer toRocketMQStreamerTest.java
. -
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.
© 2024 The Apache Software Foundation.
Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are either registered trademarks or trademarks of The Apache Software Foundation.
Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are either registered trademarks or trademarks of The Apache Software Foundation.