title: spring boot rabbitmq dead letter queue config not work
body: <p>I config spring boot rabbit' dead letter queue, but ErrorHandler never receive any message. I search all the questiones about dead letter queue, but could not figure out. Can anyone help me ?</p>
  
  <p>RabbitConfig.java to config dead letter queue/exchange:</p>
  
  <pre><code>@Configuration
  public class RabbitConfig {
  
  public final static String MAIL_QUEUE = "mail_queue";
  
  public final static String DEAD_LETTER_EXCHANGE = "dead_letter_exchange";
  
  public final static String DEAD_LETTER_QUEUE = "dead_letter_queue";
  
  public static Map&lt;String, Object&gt; args = new HashMap&lt;String, Object&gt;();
  
  static {
      args.put("x-dead-letter-exchange", DEAD_LETTER_EXCHANGE);
      //args.put("x-dead-letter-routing-key", DEAD_LETTER_QUEUE);
      args.put("x-message-ttl", 5000);
  }
  
  @Bean
  public Queue mailQueue() {
      return new Queue(MAIL_QUEUE, true, false, false, args);
  }
  
  @Bean
  public Queue deadLetterQueue() {
      return new Queue(DEAD_LETTER_QUEUE, true);
  }
  
  @Bean
  public FanoutExchange deadLetterExchange() {
      return new FanoutExchange(DEAD_LETTER_EXCHANGE);
  }
  
  @Bean  
  public Binding deadLetterBinding() {  
      return BindingBuilder.bind(deadLetterQueue()).to(deadLetterExchange());  
  }  
  
  }
  </code></pre>
  
  <p>ErrorHandler.java to process DEAD LETTER QUEUE:</p>
  
  <pre><code>@Component
  @RabbitListener( queues = RabbitConfig.DEAD_LETTER_QUEUE)
  public class ErrorHandler {
  
  @RabbitHandler
  public void handleError(Object message) {
      System.out.println("xxxxxxxxxxxxxxxxxx"+message);
  }
  
  }
  </code></pre>
  
  <p>MailServiceImpl.java to process MAIL_QUEUE:</p>
  
  <pre><code>@Service
  @RabbitListener(queues = RabbitConfig.MAIL_QUEUE)
  @ConditionalOnProperty("spring.mail.host")
  public class MailServiceImpl implements MailService {
  
  @Autowired
  private JavaMailSender mailSender;
  
  @RabbitHandler
  @Override
  public void sendMail(TMessageMail form) {
      //......
      try {
         mailSender.save(form);
      }catch(Exception e) {
          logger.error("error in sending mail: {}", e.getMessage());
          throw new AmqpRejectAndDontRequeueException(e.getMessage());
      }
  }
  }
  </code></pre>