title: Spring-amqp- newer call listener
body: <p>Sorry I'am new in the <code>amqp</code> world. I try write simple app:</p>
  
  <pre><code>public class HelloApp {
  
  public static void main(String[] args) {
      ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
  
      final TestSender bean = context.getBean(TestSender.class);
      bean.sendMessage();
  
      }
  }
  
  
  
  @Component
  public class TestSender {
  
      @Autowired
      private RabbitTemplate template;
  
      public void sendMessage() {
  
          final Message message = new Message("Sth".getBytes(), new MessageProperties());
  
          template.send(message);
          System.out.println("Was sent");
      }
  
  }
  
  
  @Component
  public class MessageReceiver implements ChannelAwareMessageListener{
  
      @Override
      public void onMessage(Message message, Channel channel) throws Exception {
  
          System.out.println("RECEIVE "+message.getBody().toString());
  
      }
  </code></pre>
  
  <p>And <code>.xml</code> files:</p>
  
  <p><strong>spring-amqp.xml</strong></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:rabbit="http://www.springframework.org/schema/rabbit"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/rabbit        http://www.springframework.org/schema/rabbit/spring-rabbit.xsd"&gt;
  
      &lt;rabbit:connection-factory id="connectionFactory" host="localhost"/&gt;
      &lt;rabbit:admin connection-factory="connectionFactory"/&gt;
  
      &lt;rabbit:template connection-factory="connectionFactory" id="rabbitTemplate" channel-transacted="true"/&gt;
      &lt;rabbit:queue name="userMesssageQueue" /&gt;
  
      &lt;rabbit:listener-container connection-factory="connectionFactory"&gt;
          &lt;rabbit:listener ref="lis" queue-names="userMesssageQueue"/&gt;
      &lt;/rabbit:listener-container&gt;
  
      &lt;bean id="transactionManager" class="org.springframework.amqp.rabbit.transaction.RabbitTransactionManager"&gt;
          &lt;property name="connectionFactory" ref="connectionFactory"/&gt;
      &lt;/bean&gt;
      &lt;bean id="lis" class="foo.bar.MessageReceiver"/&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>spring-config.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:context="http://www.springframework.org/schema/context"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt;
      &lt;context:annotation-config /&gt;
      &lt;context:component-scan base-package="foo.bar"/&gt;
  
  
      &lt;import resource="spring-amqp.xml"/&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>When I run this application I see:</p>
  
  <pre><code>Was sent
  </code></pre>
  
  <p>But I would like to see:</p>
  
  <pre><code>Was sent
  RECEIVE ...
  </code></pre>
  
  <p>What is wrong??</p>