Service Bus I: RabbitMQ
About
RabbitMQ is a message-queueing software also known as a message broker or queue manager. Simply said; it is software where queues are defined, to which applications connect in order to transfer messages. RabbitMQ is particularly interesting for a on premise deployment of a message queueing software, as it allows you to enjoy all the benefits of a fully-fledged message-queueing software, without the involvement of third-party services in the cloud.
Download
- Open Matrix42 Marketplace
- Login with your Matrix42 Account
- Navigate to Unified Endpoint Management
- Select UEM Console
- Open UEM Console Download and Details
- Download Matrix42 Service Bus Rabbit MQ
- Extract your RabbitMQ Installation Package
RabbitMQ Installation Package content
The current RabbitMQ getting started package contains
- Erlang OTP 22.1
- TTP is a set of Erlang libraries and design principles providing middle ware to develop these systems. It includes its own distributed database, applications to interface towards other languages, debugging and release handling tools. It is a pre-requisite for the RabbitMQ server
- RabbitMQ Server 3.8 for 64bit Windows system
- Matrix42 CreateRabbitMqExchangeAndQueues.ps1 PowerShell script
Prerequisites
RabbitMQ Firewall Settings
Please open the following Ports used by RabbitMQ:
Port | Purpose |
---|---|
5672, 5671 | Used by the protocol AMQP 0-9-1 and 1.0 clients with and without TLS |
15672 | HTTP API clients, management UI and rabbitmqadmin (only if the management plugin is enabled) |
Installation
Please choose:
Automated Installation and configuration
The installation comes as self-extracting package. When you run the RabbitMQ_InstallPackage.exe, it automatically executes the PowerShell script Install-RabbitMqServer.ps1, which is part of the package. It allows an automated installation of the required components, please note that the installation will be placed in the default directories of the corresponding programs. After the automated installation, the RabbitMQ server will also be configured with default values for exchanging messages - except the username and its passwort (those will be asked during the script execution). In detail these parameters are
VirtualHost | matrix42 |
ExchangeName | matrix42.suem.topic |
ServiceStoreQueueName | matrix42.uux.subscription |
EmpirumQueueName | matrix42.empirum.subscription |
SilverbackQueueName | matrix42.silverback.subscription |
The default connection string based on this installation and configuration would look like this:
amqp://<username>:<password>@<FQDN of your RabbitMQ Server>/matrix42
If you want to install all components semi-automated, please extract the compressed file RabbitMQ_InstallPackage.exe, change the current directory to the package root and execute the script as shown below. You must execute the script as Administrator.
.\Install-RabbitMqServer.ps1
The script will install Erlang, RabbitMQ and the RabbitMQ Management Plugin.
After execution you can login to the management web UI of running RabbitMQ service on the localhost.
http://localhost:15672
Login as user ‘guest’ with password ‘guest’ as default credential.
Don’t forget to change the guest password or disable the guest user entirely (latter is recommended). This user must only be used during installation from and to localhost (https://www.rabbitmq.com/access-control.html).
If you prefer more control over the installation refer to next chapter of manual installation.
Otherwise skip the next chapter about manual installation of RabbitMQ server, and proceed with
Manual Installation
For a manual installation, please open the RabbitMQ_InstallPackage.exe with e.g. 7Zip and extract the content.
- rabbitmq-server-3.8.3.exe
- otp_win64_22.1.exe
- Install-RabbitMqServer.ps1
- CreateRabbitMqExchangeAndQueues.ps1
Erlang OTP
RabbitMQ requires a 64-bit supported version of Erlang for Windows to be installed.
Use the installer
- Start the Erlang OTP installer, e.g. otp_win64_22.1.exe
- Click next
- Click next
- Optional: define a Destination Folder of choice
- Click install and confirm all installations
- Click Close
- Once Erlang is installed, we need to set Erlang home directory as a variable in your environment so the RabbitMQ installation can find it
Set ERLANG_HOME=C:\Program Files\erl10.5
Use a command line
- Run the provided installer with the following parameters from CMD
otp_win64_22.1.exe /S
- This will install the Erlang OTP in its default location
C:\Program Files\erl10.5
- Optionally it is possible to define the installation directory as follows
otp_win64_22.1.exe /S /D=
- The /D parameter expects a path to which Erlang OTP should be deployed
- For the Step by Step guide we will assume you used the default settings
- Once Erlang is installed, we need to set Erlang home directory as a variable in your environment so the RabbitMQ installation can find it
Set ERLANG_HOME=C:\Program Files\erl10.5
Attention: Don’t forget to change the guest password or disable the guest user entirely (latter is recommended). This user must only be used during installation from and to localhost (https://www.rabbitmq.com/access-control.html).
RabbitMQ Server
Use the installer
- Start the Rabbit MQ installer, e.g. rabbitmq-server -3.8.3.exe
- Press Next
- Optional: define a Destination Folder of choice
- Click Install
- Press Next
- Click Finish
Use a command line
- Run the provided installer with the following parameters from CMD
rabbitmq-server-3.8.0.exe /S
This will install RabbitMQ server by default to:
C:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.0
- It installs RabbitMQ as a Windows service and starts it using the default configuration.
set RABBITMQ_BASE="C:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.0"
Enable RabbitMQ Management Plugin
- Start a CMD and change directory to your installation folder:
C:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.3\sbin\
- Execute rabbitmq-plugins.bat with the following parameters:
rabbitmq-plugins.bat enable rabbitmq_management
- This will install the necessary management plugins of RabbitMQ.
- Check the services running on the machine you installed RabbitMQ to.
- Start RabbitMQ Service if not already running.
- Execute now the rabbitmq-services.bat
rabbitmq-service.bat start
Open Management Console
- Once the Management Console is available it can be accessed via a web browser at: http://localhost:15672
- Use a web browser of choice and navigate to: http://localhost:15672
- Login as user guest with password guest as default credential.
Install OpenSSL (optional)
If you’re planning to use SSL, use the latest OpenSSL available. Following is a rough sketch of providing RabbitMQ the necessary SSL files
- Create a directory within your RabbitMQ installation directory mkdir C:\Program Files\RabbitMQ Server\ssl
- Change to the created directory cd C:\Program Files\RabbitMQ Server\ssl
- Extract files from your Open SSL source to the SSL directory.
- Please proceed with the configuration of your TLS support in RabbitMQ as described in the official RabbitMQ manual.
Create Exchange and Queues
Use the PowerShell Script (Matrix42) ‘CreateRabbitMqExchangeAndQueues.ps1’ as administrator to create a Topic Exchange and two queues bound to it in your new RabbitMQ system - if you have not yet configured it by the automated installation and configuration.
.\CreateRabbitMqExchangeAndQueues.ps1 -ManagerUrl "http://localhost:15672" -VirtualHost "matrix42" -ExchangeName "matrix42.suem.topic" -EmpirumQueueName "matrix42.empirum.subscription" -ServiceStoreQueueName "matrix42.uux.subscription" -SilverbackQueueName "matrix42.silverback.subscription"
Don’t forget to change the guest password or disable the guest user entirely (latter is recommended). This user must only be used during installation from and to localhost (https://www.rabbitmq.com/access-control.html).
ManagerURL | The URL address of the RabbitMQ manager interface |
---|---|
VirtualHost | RabbitMQ is multi-tenant system: connections, exchanges, queues, bindings, user permissions, policies and some other things belong to virtual hosts, logical groups of entities. A virtual host has a name. When an AMQP 0-9-1 client connects to RabbitMQ, it specifies a vhost name to connect to. This name is required by the script to operate correctly. In our example above we used the VirtualHost "matrix42". |
ExchangeName | Also known as Topics, Exchanges are message routing agents, defined by the virtual host within RabbitMQ. An exchange is responsible for routing the messages to different queues. In our example above we used the ExchangeName "matrix42.suem.topic" |
Empirum Queue Name | EmpirumQueueName is the Queue used by your Empirum UEM Backend to publish messages. |
Service Store Queue Name | ServiceStoreQueueName is the Queue used by your UEM Console Backend to receive messages |
Silverback Queue Name | Silverback Queue Name is the Queue used by Silverback to publish messages |
A username and password for accessing the RabbitMQ system will be created by the powershell script based on your given input.
Review Exchanges and Queues
- Navigate back to your RabbitMQ Management Console
- Navigate to Exchanges
- You should see the matrix42.suem.topic
- Navigate to Queues
- You should see now three new queues
- matrix42.empirum.subscription
- matrix42.uux.subscription
- matrix42.silverback.subscription
- You should see now three new queues
- Navigate to Admin
- You should see now your previously entered administrative username