Getting Started with MapR Streams
If you have a basic understanding of MapR Streams's components and the typical flow of messages from producers to consumers, you can give MapR Streams a try.
Prerequisites
- Ensure that your Linux, Windows, or OS X system has Java SDK 7 or later installed.
- Install the latest version of MapR on a cluster.
- Install the MapR client package, if you want to run the producer and consumer from a machine outside the cluster.
About this task
Procedure
-
On a node in the MapR cluster, follow these steps:
-
On the system where the MapR client is installed, compile and launch the Java
consumer first and then launch the Java producer.
In both the consumer and producer, change this text to the path and name of your stream and to the name of the first of the topics:
/<path to and name of the stream>:<name of topic>
For the steps of compiling and launching, see Compiling and Launching Producers and Consumers.
Launch the consumer first, and then launch the producer. If you launch the producer first and then the consumer, the producer publishes 50 messages, but the consumer (as consumers do by default) starts reading from the head of the partition, which is after the 50 messages.
If you launch the consumer first, the partition is empty and the consumer continuously polls for new messages.
After you launch the producer, the fifty messages are published to the partition, and the consumer can move forward in the partition, reading the messages.