RabbitMQ client ( java )
Maven 依赖
<dependency> <groupId>com.rabbitmq</groupId> <artifactId>amqp-client</artifactId> <version>3.5.4</version> </dependency>
GitHub
https://github.com/rabbitmq/rabbitmq-java-client/archives/master
文档
http://www.rabbitmq.com/getstarted.html
基本概念理解
A producer a program that sends messages.
A queue is the name for a mailbox.
A consumer is a program that mostly waits to receive messages.
The connection abstracts the socket connection, and takes care of protocol version negotiation and authentication and so on for us.
A channel is where most of the API for getting things done resides.
An exchange receives messages from producers and pushes them to queues.
AMQP(Advanced Message Queuing Protocol) is an open standard application layer protocol for message-oriented middleware.
RPC(Remote Procedure Call)is a pattern that run a function on a remote computer and wait for the result.
Hello World
1. 队列没有边界限制,是一个无穷大缓存。
2.如果想要连接其他机器的broker,需要设置它的ip
3.发消息前需要声明队列,当且仅当队列不存在时才会创建
4.收消息前也需要声明队列,consumer优先启动时,需要明确从哪个队列消费
5.