Spring AMQP - RabbitMQ CheatSheet
AMQP:
-
Types of JMS
- point to point model (One to one (queues))
- publisher and subscriber model ( One to many (topics))
-
Types of AMQP
- Direct exchange = JMS point-to-point messaging based on queues
- Fanout exchange = JMS publish-subscribe messaging based on topics
- Topic exchange = JMS publish-subscribe messaging based on topics
- Header exchange = JMS publish-subscribe messaging based on topics
-
The AMQP specification is an open specification being developed by the AMQP working group.
-
There are currently several open source implementations fro AMQP available like
- RabbitMQ
- StormMQ
- Apache Qpid.
-
RabbitMQ, Kafka, and ActiveMQ all serve the same basic purpose
- Kafka is a high-throughput distributed messaging system
- RabbitMQ is an AMQP based reliable message broker.
- ActiveMQ and Kafka are both Apache products, and both written in Java
- RabbitMQ is written in Erlang.
- Apache ActiveMQ is a message broker which fully implements the Java Messaging Service API
-
JMS providers
- Amazon SQS's Java Messaging Library
- Apache ActiveMQ.
- Apache Qpid, using AMQP
- IBM MQ
-
https://www.rabbitmq.com/tutorials/tutorial-one-spring-amqp.html
-
Types of AMQP Exchange
- Direct
- Fanout
- Headers
- Match
- Trace
- Topic
-
RabbitMQ Coding architecture
- ConnectionFactory
- Connection
- Channel => Area in Real world => Within channel we create Queues => RabbitTemplate is simmilar to channel
- Queue
- Exchange
- Routingkey
- BindingBuilder => Bind queue to Exchange with RoutingKey
-
Work Queues
- Work Queues are developed based on Aka Task Queues
- Work Queues is to avoid doing a resource-intensive task immediately and having to wait for it to complete.
-
Consumer Acknowledgements and Publisher Confirms (protocols for Acknowledgements)
- Consumer Acknowledgements : Delivery processing acknowledgements from consumers to RabbitMQ
- publisher confirms : Broker acknowledgements to publishers
- Both features build on the same idea and are inspired by TCP. They are essential for reliable delivery both from publishers to RabbitMQ nodes and from RabbitMQ nodes to consumers
- channel.basicReject(deliveryTag, requeue)
- defaultRequeueRejected=false
- channel.basicAck()
- delivery acknowledgement are usually exposed as operations on a channel in client libraries.