title: How to properly use RabbitMQ direct exchange communication with Node.js driver?
body: <p>I'm trying a RabbitMQ first test with Node.js connection module, I wanted to try first <em>direct exchange</em> so I got both a <em>server</em> where I'm also trying to listen to messages and a publisher script.</p>
  
  <p><strong>Server:</strong></p>
  
  <pre><code>var amqp = require('amqp');
  var connection = amqp.createConnection();
  
  connection.on('ready', function () {
  
      var queue = connection.queue('mongo-ops');
  
      connection.exchange('badanie-exchange', {type: 'direct', durable: 'true'}, function () {
          queue.bind('badanie-exchange', '*');
          queue.subscribe(function (message) {
              console.log(message);
          })
      });
  });
  </code></pre>
  
  <p><strong>Publisher:</strong></p>
  
  <pre><code>var amqp = require('amqp');
  var connection = amqp.createConnection();
  
  connection.on('ready', function () {
  
      var exchange = connection.exchange('badanie-exchange');
  
      exchange.publish('*', "La decima", function (err,result) {
          console.log(err,result);
      });
  });
  </code></pre>
  
  <p>So, from my understanding I'm:</p>
  
  <ol>
  <li>Creating <code>badanie-exchange</code> exchange which happens to be <em><code>direct</code></em> type.</li>
  <li>Defining a queue which gets a binding to the previously defined exchange and define a routing key for it.</li>
  <li>Start listening on that queue.</li>
  <li>Simply connect to that queue and publish.</li>
  </ol>
  
  <p>However when I run both scripts, nothing happens on console. What am I doing wrong?</p>
  
  <p>Testing from <code>rabbitmqctl</code> I tried:</p>
  
  <pre><code>&gt; $ sudo rabbitmqctl list_exchanges ⬡ 0.12.7
  Listing exchanges ...
  amq.direct      direct
  amq.topic       topic
  amq.rabbitmq.trace      topic
  amq.rabbitmq.log        topic
  amq.fanout      fanout
  amq.headers     headers
          direct
  amq.match       headers
  badanie-exchange       direct
  ...done.
  </code></pre>
  
  <p>And</p>
  
  <pre><code>&gt; $ sudo rabbitmqctl list_queues ⬡ 0.12.7
  Listing queues ...
  mongo-ops       0
  ...done.
  </code></pre>