title: Using EasyNetQ with RabbitMQ to publish and receive messages
body: <p>I'm new to messaging, and currently investigating using <a href="http://www.rabbitmq.com/" rel="noreferrer">RabbitMQ</a> as part of our system architecture to provide messaging between different services.  I've got a <a href="http://www.jarloo.com/rabbitmq-c-tutorial/" rel="noreferrer">basic RabbitMQ example</a> working and it can transmit a basic text message over the bus.  It looks like <a href="http://mikehadlow.blogspot.com/2011/05/easynetq-simple-net-api-for-rabbitmq.html" rel="noreferrer">EasyNetQ</a> could simply some of the complexity of using RabbitMQ, though I'm having a little trouble getting it working.</p>
  
  <p>Instead of just a string, I'd like to send a more advanced message represented by the following class:</p>
  
  <pre><code>public class Message
  {
      public string Text { get; set; }
      public int RandomNumber { get; set; }
      public DateTime Date { get; set; }
  }
  </code></pre>
  
  <p>I'm trying to send this by publishing it to the queue, and then have the subscriber pick it up off the queue. My code is as follows:</p>
  
  <p><strong>Publisher</strong></p>
  
  <pre><code>using (var bus = RabbitHutch.CreateBus("host=localhost"))
  {
      var message = new Message() { Text = "Hello World", RandomNumber = new Random().Next(1,100), Date = DateTime.Now };
      bus.Publish&lt;Message&gt;(message);
  }
  </code></pre>
  
  <p><strong>Receiver</strong></p>
  
  <pre><code>using (var bus = RabbitHutch.CreateBus("host=localhost"))
  {
      bus.Subscribe&lt;Message&gt;("test", m =&gt; Console.WriteLine(string.Format("Text: {0}, RandomNumber: {1}, Date: {2}", m.Text, m.RandomNumber, m.Date)));
  }
  </code></pre>
  
  <p>Both sides seem to connect, and the publisher reports that the message was published:</p>
  
  <pre><code>DEBUG: Trying to connect
  INFO: Connected to RabbitMQ. Broker: 'localhost', VHost: '/'
  DEBUG: Published UserQuery+Message:query_lzzfst, CorrelationId ec81fc89-4d60-4a8b-8ba2-7a6d0818d2ed
  </code></pre>
  
  <p>The subscriber logs the following:</p>
  
  <pre><code>DEBUG: Trying to connect
  INFO: Connected to RabbitMQ. Broker: 'localhost', VHost: '/'
  </code></pre>
  
  <p>It looks like the subscriber is either not connecting to a queue (or the correct queue), or there is something else I need to do to actually receive the message?</p>