View Javadoc

1   package org.apache.james.jms.consumer;
2   
3   import org.apache.commons.logging.Log;
4   import org.apache.commons.logging.LogFactory;
5   import org.apache.james.api.jms.MailConsumer;
6   import org.apache.mailet.Mail;
7   
8   /**
9    * Sample consumer just logs.
10   * Useful for debugging.
11   */
12  public final class LogConsumer implements MailConsumer {
13  
14      private Log log = LogFactory.getLog(LogConsumer.class);
15      
16      public void consume(Mail mail) {
17          log.info(mail);
18      }
19  
20      public void reportIssue(Exception e, Object message) {
21          log.info(message, e);
22      }
23  
24      public Log getLog() {
25          return log;
26      }
27  
28      public void setLog(Log log) {
29          this.log = log;
30      }
31  
32      /**
33    * Renders into a string suitable for logging.
34    * @return a <code>String</code> representation 
35    * of this object.
36    */
37      public String toString()
38      {
39          return "LogConsumer";
40      }   
41  }