itang / todo.itang.me

4 stars 2 forks source link

MQ进阶[持续进行中] #36

Open itang opened 10 years ago

itang commented 10 years ago

apache-kafka

http://tim.dysinger.net/posts/2013-09-16-getting-started-with-nanomsg.html

http://www.bravenewgeek.com/a-look-at-nanomsg-and-scalability-protocols/

  1. [ ] HornetQ http://hornetq.jboss.org/
  2. [ ] rabbitmq http://www.rabbitmq.com/

    【架构】关于RabbitMQ

  3. [ ] 熟悉 http://mqtt.org/

rabbitmq-plugins, rabbitmq-server, rabbitmqctl

启动: sudo rabbitmq-server & 状态: sudo rabbitmqctl status 停止: sudo rabbitmqctl stop

查看队列: sudo rabbitmqctl list_queues sudo rabbitmqctl list_queues name messages_ready messages_unacknowledged

查看exchange sudo rabbitmqctl list_exchanges

查看binding sudo rabbitmqctl list_bindings

启用插件: sudo rabbitmq-plugins enable rabbitmq_mqtt

sudo rabbitmq-plugins enable rabbitmq_stomp

概念,术语

ACK(Acknowledgement) 即确认字符,在数据通信中,接收站发给发送站的一种传输类控制字符。表示发来的数据已确认接收无误。

MQTT

Transient (QoS0) subscription use non-durable, auto-delete queues that will be deleted when the client disconnects.

Durable (QoS1) subscriptions use durable queues. Whether the queues are auto-deleted is controlled by the client's clean session flag. Clients with clean sessions use auto-deleted queues, others use non-auto-deleted ones.

The subscription_ttl option controls the lifetime of non-clean sessions. This option is interpreted in the same way as the queue TTL parameter, so the value 1800000 means 30 minutes.

The prefetch option controls the maximum number of unacknowledged messages that will be delivered. This option is interpreted in the same way as the AMQP prefetch-count field, so a value of 0 means "no limit".

A producer is a user application that sends messages.

A queue is a buffer that stores messages.

A consumer is a user application that receives messages.

An exchange is a very simple thing. On one side it receives messages from producers and the other side it pushes them to queues.

direct exchange: a message goes to the queues whose binding key exactly matches the routing key of the message

topic exchange: is similar to a direct one - a message sent with a particular routing key will be delivered to all the queues that are bound with a matching binding key. However there are two important special cases for binding keys:

队列模式:

“立即都模式”: 非持久化非ack: 将礼物”都“分给不同的receiver, ”有先来后到“ round-robin: ”带位置信息的分发模式“: 持久化, ack; 将任务”均“分给不同的task

itang commented 10 years ago

uninstall:

$ sudo apt-get remove rabbitmq-server $ sudo apt-get autoremove