title: Using @JmsListener with logging
body: <p>I'm following a guide on using Spring JMS using the JmsListener annotation at the method level.  I think it is working but since I can't debug my breakpoint set in that method or log4j logging doesn't work, or not even a simple System.out.println(), I'm not 100% sure that destination is hitting.</p>
  
  <pre><code>@Component
  public class JmsEmailServiceConsumer {
      private final Logger log = LoggerFactory.getLogger(this.getClass());
  
      private final JmsEmailService jmsEmailService;
  
      @Autowired
      public JmsEmailServiceConsumer(JmsEmailService jmsEmailService){
          this.jmsEmailService = jmsEmailService;
      }
  
      @JmsListener(destination = "simple.queue")
      public void receiveEmailData(EmailData emailData) {
          jmsEmailService.sendEmail(emailData);
      }
  }
  </code></pre>
  
  <p>Pretty simple task.  All I'm trying to do is create a JMS queue to handle the generating of emails.  This process makes a call to the Service, jmsEmailService, which determines via calls to DAOs to select a list of email addresses to send emails.  If none are found, no email is sent.  Now I am testing locally and I don't have an email server up and running but I want to verify if the calls to the DAOs are working.  If they are then I can proceed with committing in the code and get QA to test the email process.</p>
  
  <p>I did it this way because of a blog I found that really removes the bulk of dealing with JMS.  As you can see, all I needed to do was annotate the receiveEmailData method with JmsListener and provide a destination which has already been setup in the Producer class as:</p>
  
  <pre><code>private static final String SIMPLE_QUEUE = "simple.queue";
  
  @Autowired
  public JmsEmailProducerImpl(JmsTemplate jmsTemplate) {
      this.jmsTemplate = jmsTemplate;
  }
  
  @Override
  public void sendEmail(EmailData emailData) {
      //EmailData emailData = new EmailData(userId, person, company, roleKind, isRemoved);
      jmsTemplate.convertAndSend(SIMPLE_QUEUE, emailData);
  } 
  </code></pre>
  
  <p>Pretty easy right?  That's what I thought.  For reference, here's the website I am looking at:  </p>
  
  <p><a href="http://xpadro.blogspot.com/2015/04/configure-spring-jms-application-with.html" rel="nofollow">http://xpadro.blogspot.com/2015/04/configure-spring-jms-application-with.html</a></p>
  
  <p>Any thoughts?  I can place a breakpoint at the line in the producer class which works, but once the jmsTemplate fires off the convertAndSend method, no breakpoint in the consumer class, System.out.println() or log4j logging works.  I do see this in my broker logging:</p>
  
  <pre><code>2015-10-26 00:02:34,804 DEBUG   org.apache.activemq.broker.region.Queue::expireMessages:905    queue://simple.queue expiring messages ..
  2015-10-26 00:02:34,804 DEBUG org.apache.activemq.broker.region.Queue::expireMessages:911   queue://simple.queue expiring messages done.
  2015-10-26 00:02:34,804 DEBUG org.apache.activemq.broker.region.Queue::doPageInForDispatch:1874   queue://simple.queue, subscriptions=0, memory=0%, size=2, pending=0 toPageIn: 0, Inflight: 0, pagedInMessages.size 2, pagedInPendingDispatch.size 2, enqueueCount: 2, dequeueCount: 0, memUsage:48394
  </code></pre>