Get Started with Hazelcast Jet

Create Your First Jet Job

  1. Download the latest Hazelcast Jet release.
  2. Unzip it and add the lib/hazelcast-0.x.jar to your class path.
  3. Create a Java class and import Jet libraries.
  4. The following code will start Jet cluster with two nodes. Aggregation application (word count) will be processed in distributed way:
  5. import com.hazelcast.core.IMap;
    import com.hazelcast.jet.Jet;
    import com.hazelcast.jet.JetInstance;
    import java.util.Arrays;
    import java.util.regex.Pattern;
    import static;
    public class WordCount {
        private static final Pattern PATTERN = Pattern.compile("\\W+");
        public static void main(String[] args) {
            JetInstance jet = Jet.newJetInstance();
            // Create an additional instance; it will automatically
            // discover the first one and form a cluster
            IStreamMap<Integer, String> source = jet.getMap("source");
            source.put(0, "It was the best of times, " +
                    "it was the worst of times ");
            source.put(1, "There were a king with a large jaw and a " +
                    "queen with a plain face, on the that things in " +
                    "general were settled for ever.");
            source.put(2, "It was the year of Our Lord one thousand " +
                    "seven hundred and seventy-five. Spiritual " +
                    "revelations were conceded to England at that " +
                    "favoured period");
            IMap<String, Integer> counts = source
                    .map(e -> e.getValue().toLowerCase())
                    .flatMap(line ->
                    .collect(toIMap("counts", m -> m, m -> 1,
                            (left, right) -> left + right));
            System.out.println("Counts=" + counts.entrySet());
  6. See more code samples and explore more Jet features.

What’s Next

Get Hands-on Training

Sign up for hands-on training from Hazelcast experts, online or in the classroom.

Learn more at Hazelcast University

Hazelcast 3.6 Deployment and Operations Guide

Read It Online Now

Main Menu