Queue
message buffer. consumer reads messages from Queue.
Exchange
producer sends messages to Exchange. And Exchange will route messages to Queues.
types
- direct. 只能exactly match routing key 到binding key 上
- fanout. 向所有bind 上的queue 发送,忽略routing key
- topic. 可以根据topic ( 带通配符的binding key) 来route 消息
Message
message carries a routing key. eg. "log", "quick.brown.fox"
Routing Key
Exchange uses Routing Key to decide wich queue the message should be delivered to.
Bind
bind a queue to a specific exchange ( and possibly a binding key)
binding key
the key/pattern exchange uses to match a routing key
Topic
带通配符的binding key. * - matches a word. # - matches 0 or more words
eg.
[producer] -[Msg (routing key "error"/"info")]
|
-> [Exchange "log"] -[Msg "error"]-> [Queue (bind Exchange log, key "error")]
|
-> [Msg "info"] -> [Queue (bind exchange "log", key "info"]