Set up your development environment

Setting up your development environment involves downloading and installing Red Hat AMQ Broker:

  1. Download the latest version of AMQ Broker. The latest version at the time of this writing is Red Hat AMQ Broker 7.7 GA.

  2. Unzip AMQ Broker to any destination. This document will refer to this directory as AMQ_HOME.

    • On Windows or Mac, extract the contents of the ZIP archive by double-clicking on the ZIP file.

    • On Red Hat Enterprise Linux, open a terminal window in the target machine and navigate to where the ZIP file was downloaded. Extract the ZIP file by executing the following command:

      $ unzip amq-broker-7.7.0-bin.zip

Create and run an AMQ Broker instance

The artemis script located in the bin folder is the starting point for managing our AMQ installation:

  1. Create a broker instance. Execute the following command to create a new broker in the instances folder.

    $ <AMQ_HOME>/bin/artemis create --user admin --password password --role admin --allow-anonymous y <AMQ_HOME>/instances/mybroker

    This command creates a broker in the <AMQ_HOME>/instances/mybroker folder, with the admin default user assigned to the admin role and their password set to password. This broker also accepts anonymous users connecting to the broker from localhost. The folder where the broker is installed is referred to as AMQ_INSTANCE.

  2. Start the broker instance:

    To start the broker, run this command from the <AMQ_INSTANCE> folder:

    $ bin/artemis run

    After you run this command, a console log will appear and the broker will be running.

Start using the broker

Examples of how to produce and consume messages:

  1. Send 1000 messages to the broker:

    AMQ_INSTANCE/bin/artemis producer
  2. Consume messages from broker:

    AMQ_INSTANCE/bin/artemis consumer
     

You just sent and received messages via Red Hat A­MQ Broker. Visit frequently to view more tutorials on connecting via MQTT, STOMP, and other topics around A­MQ.

Last updated: January 22, 2021