写点什么

RabbitMQ-AMQP 简介

用户头像
云淡风轻
关注
发布于: 2020 年 05 月 23 日

全称:Advanced Message Queuing Protocol

结构模型:


发布者:

Publisher: Produce and publish messages


交换机:

Direct Exchange:A direct exchange delivers messages to queues based on the message routing key.

Fanout Exchange:A fanout exchange routes messages to all of the queues that are bound to it and the routing key is ignored. 

Topic Exchange: Topic exchanges route messages to one or many queues based on matching between a message routing key and the pattern that was used to bind a queue to an exchange. 

Header Exchange:A headers exchange is designed for routing on multiple attributes that are more easily expressed as message headers than a routing key.


队列:

Queue: store messages that are consumed by applications. 


消费者:

Consumer: Storing messages in queues is useless unless applications can consume them,there are two ways for applications to do this:

  • Subscribe to have messages delivered to them ("push API"): this is the recommended option

  • Polling ("pull API"): this way is highly inefficient and should be avoided in most cases


消息确认:

when should the broker remove messages from queues?

  • After broker sends a message to an application (using either basic.deliver or basic.get-ok method).

  • After the application sends back an acknowledgement (using the basic.ack method).


启动会话








AMQP 使用类和方法在客户端和服务器之间创建公共语言,这些类和方法被称为 AMQP 命令( AMQPcommands)。

e.g.

Connection.Start 命令由两个组件组成 : AMQP 类(Class) 和方法 (Method)。

AMQP 帧构成:

AMQP 规范定义了五种类型的帧 : 协议头帧、方法帧、内容头帧、消息体帧及心跳帧。



reference:https://www.rabbitmq.com/tutorials/amqp-concepts.html#amqp-model

用户头像

云淡风轻

关注

云淡风轻 2018.08.18 加入

JAVA软件工程师

评论

发布
暂无评论
RabbitMQ-AMQP简介