title: Receive and Send Java Objects with Spring AMQP
body: <p>I want to implement Spring AMQP example for sending and receiving Java Objects using listener. I tried this:</p>
  
  <p>Send Java Object </p>
  
  <pre><code>ConnectionFactory connectionFactory = new CachingConnectionFactory("localhost");
  AmqpAdmin admin = new RabbitAdmin(connectionFactory);
  admin.declareBinding(BindingBuilder.bind(new Queue(QUEUE_PROCESSING_TRANSACTION, false)).to(new TopicExchange(EXCHANGE_PROCESSING)).with(ROUTING_KEY_PROCESSING_TRANSACTION));              
  AmqpTemplate template = new RabbitTemplate(connectionFactory);
  
  TransactionsBean obj = new TransactionsBean();
  obj.setId(Long.valueOf(111222333));
  </code></pre>
  
  <p>Receive and send Back another Java Object:</p>
  
  <pre><code>ConnectionFactory connectionFactory = new CachingConnectionFactory("localhost");
  AmqpAdmin admin = new RabbitAdmin(connectionFactory);
  admin.declareBinding(BindingBuilder.bind(new Queue(QUEUE_PROCESSING_TRANSACTION, false))
                  .to(new TopicExchange(EXCHANGE_PROCESSING)).with(ROUTING_KEY_PROCESSING_TRANSACTION));
  AmqpTemplate template = new RabbitTemplate(connectionFactory);
  
  TransactionsBean obj = (TransactionsBean) template.receiveAndConvert(QUEUE_PROCESSING_TRANSACTION);
  System.out.println(" !!!!!!! Received id " + obj.getTransaction_id());
  
  SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
  container.setConnectionFactory(connectionFactory);
  container.setQueues(new Queue(QUEUE_PROCESSING_TRANSACTION, false));
  
  container.setMessageListener(new MessageListener() {
    @Override
    public void onMessage(Message message) {
      // Receive here Java object and send back another object
    }
  });
  </code></pre>
  
  <p>Can you show me how to extend the code without complex annotations just simple listeners?</p>