Different Exchange Types in RabbitMQ

channel.ExchangeDeclare(exchange: "fanoutExchange", type: ExchangeType.Fanout);orchannel.ExchangeDeclare(exchange: "fanoutExchange", type: "fanout");
  1. Fanout: This is the default exchange type and it just broadcasts all the messages it receives to all the queues it knows. Above example code shows how to define this exchange type and if exchange type is not defined then by default it will be fanout. In fanout exchange type headers, binding or routing keys will be ignored even if it is provided and messages will be published to all the available queues.
channel.BasicPublish(exchange: "directExchange",
routingKey: "mysecretchannel",
basicProperties: properties,
body: body);
channel.ExchangeDeclare(exchange: "directExchange", type: ExchangeType.Direct);channel.QueueBind(queue: "myMsgQueue", exchange: "directExchange", routingKey: "mysecretchannel");

--

--

--

Passionate about Software designing & development and Learning Technologies and Love to share what I learn.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Vectorization vs Parallelization: Making your code run faster

Juspay Interview Experience | Internship | Oncampus 2020

Strapi Support: Most frequently asked questions on the website

12 Sources of Inspiration for 20 Tech Articles

OOP IN JAVA

Web Scraper for Parsing Technical Skills Keywords on indeed.com (Part 1)

Choose your SQL Database option on Azure

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Binod Mahto

Binod Mahto

Passionate about Software designing & development and Learning Technologies and Love to share what I learn.

More from Medium

Introduction to MongoDB

Build a microservices system from scratch — commit 7

Implementing an Event-Based Collaboration using HTTP

Building Message-Oriented Microservices with Google Pub/Sub and .NET 6