title: Concurrency in RabbitMQ
body: <p>After a week of coding and searching forums, it seems timely to ask...</p>
  
  <p>I have a C# application which processes messages sent by RabbitMQ using EventingBasicConsumer. I want to process several messages concurrently, so I have instantiated a few channels (8 in this case) on the same connection, each with a single consumer. I have then attached an event-handler to each consumer's Received event. Based on all my readings so far, this setup should allow the event-handler to be triggered concurrently by the consumers, each running in its own thread. But in my case consumers receive messages sequentially only after the a previous consumer acknowledges its message. </p>
  
  <p>Has anyone else experienced this behavior? Is my understanding correct that the processing should technically be concurrent in this case?</p>
  
  <p>Below is a basic code to better illustrate the issue:</p>
  
  <pre><code>Initialise() {
      ConsumerChannels_ = new IModel[ConsumerCount_];
      Consumers_ = new EventingBasicConsumer[ConsumerCount_];
      for (int i = 0; i &lt; ConsumerCount_; ++i)
      {
           ConsumerChannels_[i] = Connection_.CreateModel();
           Consumers_[i] = new EventingBasicConsumer(ConsumerChannels_[i]);
           Consumers_[i].Received += MessageReceived;
      }
  }
  
  MessageReceived(IBasicConsumer sender, BasicDeliverEventArgs e)
  {
      int id = GetConsumerIndex(sender);
      Log_.Debug("Consumer " + id + ": processing started...");         
      // do some time consuming processing here
      sender.Model.BasicAck(e.DeliveryTag, false);
      Log_.Debug("Consumer " + id + ": processing ended.");
  }
  </code></pre>
  
  <p>What I expect to see is something like: // concurrent processing</p>
  
  <blockquote>
    <p>Consumer 1: processing started...</p>
    
    <p>Consumer 2: processing started...</p>
    
    <p>Consumer 3: processing started...</p>
    
    <p>...</p>
    
    <p>Consumer 6: processing ended.</p>
    
    <p>Consumer 7: processing ended.</p>
    
    <p>Consumer 8: processing ended.</p>
  </blockquote>
  
  <p>But what I get instead is: // sequential processing</p>
  
  <blockquote>
    <p>Consumer 1: processing started...</p>
    
    <p>Consumer 1: processing ended.</p>
    
    <p>Consumer 2: processing started...</p>
    
    <p>Consumer 2: processing ended.</p>
    
    <p>...</p>
    
    <p>Consumer 8: processing started...</p>
    
    <p>Consumer 8: processing ended.</p>
  </blockquote>
  
  <p>Any ideas on how to proceed would be most appreciated.</p>