title: RabbitMQ Pub/Sub - Subscriber is not able to receive message
body: <p>I am using sample code to implement Publish/Subscribe using "fanout" exchange type. But as in below code subscriber is not displaying 'Hello Word' message which is published.</p>
  
  <p><strong>Publisher.cs</strong></p>
  
  <pre><code> var factory = new ConnectionFactory() { HostName = "localhost" };
          using (var connection = factory.CreateConnection())
          using (var channel = connection.CreateModel())
          {
              channel.ExchangeDeclare(exchange: "logs", type: "fanout");
  
              var message = GetMessage(args);
              var body = Encoding.UTF8.GetBytes(message);
              channel.BasicPublish(exchange: "logs",
                                   routingKey: "",
                                   basicProperties: null,
                                   body: body);
              Console.WriteLine(" [x] Sent {0}", message);
          }
  
          Console.WriteLine(" Press [enter] to exit.");
          Console.ReadLine();
      }
  
      private static string GetMessage(string[] args)
      {
          return ((args.Length &gt; 0)
                 ? string.Join(" ", args)
                 : "info: Hello World!");
      }
  </code></pre>
  
  <p><strong>Subscriber.cs</strong></p>
  
  <pre><code> var factory = new ConnectionFactory() { HostName = "localhost" };
          using (var connection = factory.CreateConnection())
          using (var channel = connection.CreateModel())
          {
              channel.ExchangeDeclare(exchange: "logs", type: "fanout");
  
              var queueName = channel.QueueDeclare().QueueName;
              channel.QueueBind(queue: queueName,
                                exchange: "logs",
                                routingKey: "");
  
              Console.WriteLine(" [*] Waiting for logs.");
  
              var consumer = new EventingBasicConsumer(channel);
              consumer.Received += (model, ea) =&gt;
              {
                  var body = ea.Body;
                  var message = Encoding.UTF8.GetString(body);
                  Console.WriteLine(" [x] {0}", message);
              };
              channel.BasicConsume(queue: queueName,
                                   noAck: true,
                                   consumer: consumer);
  
              Console.WriteLine(" Press [enter] to exit.");
              Console.ReadLine();
          }
  </code></pre>
  
  <p><strong>Code Ref:</strong> <a href="https://www.rabbitmq.com/tutorials/tutorial-three-dotnet.html" rel="nofollow">https://www.rabbitmq.com/tutorials/tutorial-three-dotnet.html</a></p>