Message Queue - RabbitMQ
Message Queue

If you think that you have a Fruit Juice Business as well as you think that you have some time to create fruit juice. So, When coming multiple customers you don’t have facility supply fruit juice for all customers at once. So, you decide to create more fruit juice business around some places. Those all juice bar has servers to coordinate their orders. In here, one fruit juice bar crash as a power problem. So, this server cannot make fruit juice. So, these orders cannot supply. Thus, They decide to store order lists in the database to identify which orders want to create. Then, they can create not complete orders although a server crash.
one way: see the database in which order belongs to the crash server. But, the problem is how to identify which server is crashed. that is very complicated.
second way: You can use a notifier to identify which server crash using the heartbeat of each server. If the server does not respond, then the notifier assumes that the server is dead. You know if it is dead it cannot handle orders. Now notifier call database and ask all of the orders not done. These orders send to remaining active servers. Thus, we can see duplicate orders run in remaining servers. So, that is a problem. Because of that, we can use a load balancer to manage orders without duplicate. This load balancer ensures these orders are not duplicated requests to the same server and balancing load. Thus, all of the servers use a set of buckets to handle orders. Then, one of a server crash, this server’s bucket is closed, thus after adding new buckets to other servers. as we maintain the bucket, no duplicate buckets adding remaining servers.
Using Notifier, Hartbeat, and Load balancing, we can notify all the failed orders to new servers. These 3 components encapsulate to one component. That is called the Message queue.
Tasks =>
1. take task
2. persists them
3. assigns them to the correct server
4. take long time to respond, get ackenoledgment that server is crash. then assigns it to next server.
Examples =>
RABBIT MQ
ZERO MQ
JMS (Java Messaging Server)
RABBIT MQ

It uses for the middle layer when a client wants to send a message to another client without knowing the receiver and different time (space uncoupling and time uncoupling). So, we can group in the layer called as Rabit MQ. The default port is 5672 and uses TCP. This RabitMQ server is an abstraction of a lot of pieces.
If you think the publisher wants to send a message to clients who are interested in this message. Then, the publisher creates a connection with the RabbitMQ server. It is a two-way communication underlying transformation protocol TCP. That means the server can also communicate with the server. And also, the client connects to the RabbitMQ server with two-way communication. Then the server pushes the consumer if the server has any message.
Channel is a logical connection. The consumer can connect more channels using the same TCP connection instead of using 3 TCP connections. That is called multiplexing. Then, consumers can identify channels using only channel IDs.