Skip to Main Content

Example: Produce & Consume Message

This article provides a step-by-step guide to conducting a basic send and receive message load to confirm the core features of AutoMQ.

After a successful installation of AutoMQ via the Cluster Deployment on Linux▸ method, you will receive a list of Bootstrap Server addresses similar to the ones shown below:

192.168.0.1:9092,192.168.0.2:9092

Should you choose to install using the Deploy Locally▸, your Bootstrap Server address will be:

broker1:9092,broker2:9092

It is crucial during all steps to substitute the Bootstrap Server address with the one you actually received.

Prerequisites

  • Linux/Mac/Windows Subsystem for Linux

  • Docker

If you experience slow download speeds for the container image, see Docker Hub Mirror Configuration▸

Create Topic


CMD='docker run --network automq_net automqinc/automq:latest /bin/bash -c "/opt/kafka/kafka/bin/kafka-topics.sh --create --topic quickstart-events --bootstrap-server broker1:9092,broker2:9092"'; [ "$(uname)" = "Linux" ] && eval "sudo $CMD" || eval $CMD

Send Message


CMD='docker run -it --network automq_net automqinc/automq:latest /bin/bash -c "/opt/kafka/kafka/bin/kafka-console-producer.sh --topic quickstart-events --bootstrap-server broker1:9092,broker2:9092"'; [ "$(uname)" = "Linux" ] && eval "sudo $CMD" || eval $CMD

Consume Messages


CMD='docker run --network automq_net automqinc/automq:latest /bin/bash -c "/opt/kafka/kafka/bin/kafka-console-consumer.sh --topic quickstart-events --from-beginning --bootstrap-server broker1:9092,broker2:9092"'; [ "$(uname)" = "Linux" ] && eval "sudo $CMD" || eval $CMD