RabitMQ - has libraries for favorite programming languages, and frameworks like spring, interface for web monitoring
RabbitMQ speaks the AMQP protocol by default.
Structure
Publisher (Producer) - Publishes message to Message Broker
Message Broker - RabbitMQ [Exchange, [Queue, ..] ]
Exchange receives messages and directs them to the correct queue
Exchange type:
Exchange type:
- Direct - sends depending on binding key.
- Topic - sends based on wildcard.
- Fanout - sends all queue, that ar bound to it.
- Durable
- exchanges will survive server restarts and will last until they are explicitly deleted.
- Temporary
- exchanges exist until RabbitMQ is shutdown.
- Auto deleted
- exchanges are removed once the last bound object unbound from the exchange.
Consumer - Consumes data. Subscribes.
Process
- Client applications called producers that create messages and deliver them to the broker (the message queue)
- Other applications, called consumers, connects to the queue and subscribes to the messages to be processed. Messages that are placed onto the queue are stored until the consumer retrieves them.
Concepts
Process
- Set up connection.(Username, password)
- Open channel in tcp connection.
- Declare/create a queue
- Subscriber/Consumer - Set up exchanges and bind a queue to an exchange. For messages to be routed to queue, queue need to be bound to exchange
- Publisher: Publish message to echange
- Subscriber/Consumer - Consume a message from queue.
- Close the channel and the connection
Resources:
cloudamqp.com - cloudAMQP
Installing rabitmq:
rabitmq status:
$ service rabbitmq-server status
enabling service:
$ chkconfig rabbitmq-server onenable plugins:
$ sudo rabbitmq-plugins enable rabbitmq_management
cmd commands:
List exchanges:
$ sudo rabbitmqctl list_exchange
By default you can't login to remote console from external non-local.
How to enable logging from remote machine to rabitmq console:
$ rabbitmqctl add_user YOUR_USERNAME YOUR_PASSWORD
$ rabbitmqctl set_user_tags YOUR_USERNAME administrator
$ rabbitmqctl set_permissions -p / YOUR_USERNAME ".*" ".*" ".*"
Problem:
$ rabbitmqctl add_user YOUR_USERNAME YOUR_PASSWORD
$ rabbitmqctl set_user_tags YOUR_USERNAME administrator
$ rabbitmqctl set_permissions -p / YOUR_USERNAME ".*" ".*" ".*"
Problem:
By default rabitmq blocks loggins from remote ip adresses. How to enable remote login?
Solution:
Goto /etc/rabbitmq folder and create rabbitmq.conf with file content:
loopback_users = none
Problem:
Can't enable web access to http://localhost:15672 from Ubuntu 16.04.4 LTS to rabbitmq
Solution:
https://simpleit.us/2017/06/04/install-rabbitmq-on-ubuntu-16.04-lts/