Launching the RabbitMQ broker

With the RabbitMQ broker installed, we just need to launch it. There are these two approaches to doing that:

  • Starting it in our current shell
  • Having it start when the machine boots

To start in our current shell, we can execute the following command:

$ rabbitmq-server
    
RabbitMQ 3.6.4. Copyright (C) 2007-2016 Pivotal Software...
##  ##      Licensed under the MPL.  See http://www.rabbitmq.com/
##  ##
##########  Logs: /usr/local/var/log/rabbitmq/[email protected]
######  ##        /usr/local/var/log/rabbitmq/rabbit@localhost-sasl....
##########
Starting broker...
completed with 10 plugins.  

On a macOS with Homebrew, use the following to launch as a daemon process and relaunch when we reboot:

$ brew services start rabbitmq
==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 10 (delta 0), reused 6 (delta 0), pack-reused 0
Unpacking objects: 100% (10/10), done.
Checking connectivity... done.
Tapped 0 formulae (36 files, 46K)
==> Successfully started `rabbitmq` (label: homebrew.mxcl.rabbitmq)  

If you are using Homebrew, there is a feature to manage various services. Type homebrew services to see the commands available. For example, brew services list will list all services and their state:

$ brew services list
  Name     Status  User       Plist
  activemq stopped
  mongodb  started gturnquist 
/Users/gturnquist/Library/LaunchAgents/hom...
mysql stopped neo4j stopped rabbitmq started gturnquist
/Users/gturnquist/Library/LaunchAgents/hom...
redis stopped tor stopped

Now we can see that RabbitMQ has joined MongoDB (which we installed in Chapter 3, Reactive Data Access with Spring Boot).

This, essentially, leverages macOS X's launchctl system with a Homebrew-supplied daemon control file.

For Windows, check out https://www.rabbitmq.com/install-windows.html. It has links to download the broker. Upon installation, it will configure it with various defaults and also start it up.

To control the broker, check out the rabbitmqctl.bat script found in the sbin folder (as administrator). Use the following commands:

  • rabbitmqctl start
  • rabbitmqctl stop
  • rabbitmqctl status
Want to poke around with the RabbitMQ broker in a more visual way? Run rabbitmq-plugins enable rabbitmq_managment, and visit http://localhost:15672. The default username/password for RabbitMQ is guest/guest. I suggest looking at Exchanges and Queues first.

With the RabbitMQ broker up and running, we can now shift focus to our application efforts.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.168.8