title: Rabbit mq error: Getting Exception in thread "main" java.io.IOException Caused by: com.rabbitmq.client.ShutdownSignalException
body: <p>Here is the error I get when I run my main. I do not really understand why it is having as issue with line 44: channel.basicConsume(Q,true,consumer); 
  My goal here is to try and store the messages received into a variable that I can use in other files.</p>
  
  <pre><code>The error is: Exception in thread "main" java.io.IOException
  at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:105)
  at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:101)
  at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1255)
  at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.basicConsume(AutorecoveringChannel.java:471)
  at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.basicConsume(AutorecoveringChannel.java:461)
  at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.basicConsume(AutorecoveringChannel.java:456)
  at Recv.recv(Recv.java:44)
  at mainLaptop.main(mainLaptop.java:11)
  Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method&lt;channel.close&gt;(reply-code=404, reply-text=NOT_FOUND - no queue 'Leonardo' in vhost '/', class-id=60, method-id=20)
  at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
  at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:32)
  at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:366)
  at com.rabbitmq.client.impl.ChannelN.basicConsume(ChannelN.java:1253)
  ... 5 more
  </code></pre>
  
  <p>Here is my code for the Recv file</p>
  
  <pre><code>    public class Recv 
      {
  
  public static String recv(String ip, String Q) throws Exception 
  {
  
      ConnectionFactory factory = new ConnectionFactory();
      factory.setHost(ip);
      factory.setUsername("test");
      factory.setPassword("test");
      Connection connection = factory.newConnection();
      Channel channel = connection.createChannel();
  
      System.out.println(" [*] Waiting for messages. To exit press CTRL+C");
      MyConsumer consumer=new MyConsumer(channel);
      channel.basicConsume(Q,true,consumer);
  
      return consumer.getStoredMessage();
  }
  
  public static class MyConsumer extends DefaultConsumer 
  {
      private String storedMessage;
  
      public MyConsumer(Channel channel) 
      {
          super(channel);
      }
  
      public String getStoredMessage() 
      {
          return storedMessage;
      }
  
      @Override
      public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body)
          throws IOException 
      {
          String message = new String(body, "UTF-8");
          System.out.println(" [x] Received '" + message + "'");
          storedMessage = message; // store message here
      }
  }
  }
  </code></pre>