A newer version of Hazelcast CLC is available.

View latest

Get Started With Hazelcast Jet Job Management

In this tutorial, you’ll learn the basics of how to manage stream processing pipelines using the Hazelcast CLC with Hazelcast Cloud. You’ll see how to connect to a cluster on Cloud, and submit a sample Jet job that generates a stream of numbers. You’ll also learn how to use simple commands to monitor and cancel jobs.

Before You Begin

You need the following:

Step 1. Authenticating with Cloud

To allow the Hazelcast CLC to perform cluster operations, including submitting Jet jobs, you must generate a Cloud token.

  1. Execute the following command to retrieve the token.

    clc viridian login
  2. When prompted, enter your API key and secret. If both are correct, the token is retrieved and saved.

Step 2. List Cluster Details

Next, check that the Hazelcast CLC can access your cluster by running the following command:

clc viridian list-clusters

The details of all clusters linked to your Cloud account are returned, including the Cluster ID, Cluster Name, Current Status, Hazelcast Version.

Step 3. Connect to Your Cluster

For Hazelcast CLC to connect to your development cluster, you need to import the cluster’s configuration, including its connection details.

Run the following command to save the cluster configuration with the name dev. Replace the $CLUSTER_NAME placeholder with the name of your cluster, shown in the top-left corner of the dashboard.

clc viridian import-config $CLUSTER_NAME --name dev

Step 4. Build the Jet Job

Now you’re ready to build the sample Jet job.

  1. Clone the GitHub repository.

    • HTTPS

    • SSH

    git clone https://github.com/hazelcast/hazelcast-commandline-client
    cd hazelcast-commandline-client/examples/platform/simple-streaming-pipeline
    git clone git@github.com:hazelcast/hazelcast-commandline-client.git
    cd hazelcast-commandline-client/examples/platform/simple-streaming-pipeline
  2. Build the project with the following command:

    gradle shadowJar

Step 5. Submit and Monitor the Jet Job

Submitting the sample Jet job generates a stream of numbers and creates a hashid for each number. The number and hashid pair are then saved to a Map called my-map, with the number as the key and hashid as the value.

  1. Execute the following command to submit the Jet job:

    clc -c dev job submit build/libs/simple-streaming-pipeline-1.0-SNAPSHOT-all.jar --name simple-pipeline --wait

    The Hazelcast CLC waits until the job starts to run.

  2. Now, list the jobs in the cluster. You should see simple-pipeline in a RUNNING state.

    clc -c dev job list
  3. See how the size of my-map increases as entries are written to it.

    • Unix

    • Windows

    1. Create a new shell script in your favorite text editor. For example:

      vi monitor.sh
    2. Add the following:

      #! /bin/bash
      while true;
      do clc -c dev map size -n my-map; sleep 3;
    3. Run your script.

    4. Press Ctrl+C when you’re ready to cancel the script.

    1. Create a new batch file in your favorite text editor. For example:

      notepad monitor.bat
    2. Add the following:

      @echo off
      clc -c dev map size -n my-map
      timeout 5
      goto start
    3. Run the batch file.

    4. Press Ctrl+C when you’re ready to cancel the script.

Step 6. Cancel the Jet job

  1. Now, cancel the Jet job.

    clc -c dev job cancel simple-pipeline
  2. Run your script (from step 5) to see the size of my-map now.


In this tutorial, you learned how to do the following:

  • Connect to a cluster on Cloud.

  • Build and submit a Hazelcast Jet job to create a data pipeline.

  • Manage the lifecycle of a Jet job using list and cancel commands.

Learn More

Use these resources to continue learning: