---
title: "Rabbitmq Exchange Type 说明"
author: "augustcoco"
date: "2015-08-14T18:00:41Z"
tags: []
categories: ["编程语言"]
slug: "rabbitmq-exchange-type"
draft: false
lastmod: "2015-08-14T18:01:30Z"
id: 2235595
url: "https://augustcoco.iteye.com/blog/2235595"
---

Rabbitmq Exchange Type 说明

Exchange在定义的时候是有类型的，以决定到底是哪些Queue符合条件，可以接收消息

fanout

所有bind到此exchange的queue都可以接收消息

direct

通过routingKey和exchange决定的那个唯一的queue可以接收消息

topic

所有符合routingKey(此时可以是一个表达式)的routingKey所bind的queue可以接收消息

表达式符号说明：#代表一个或多个字符，*代表任何字符

例：#.a会匹配a.a，aa.a，aaa.a等

*.a会匹配a.a，b.a，c.a等

注：使用RoutingKey为#，Exchange Type为topic的时候相当于使用fanout