package enterprise.web.tookit.integration.email;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageListener;
import org.apache.log4j.Logger;
/**
* Message-Driven Bean implementation class for: EmailConsumer
*
*/
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/emailService") })
public class EmailConsumer implements MessageListener {
/**
* LOG
*/
private static final Logger log = Logger.getLogger(EmailConsumer.class);
/**
* Default constructor.
*/
public EmailConsumer() {
}
/**
* @see MessageListener#onMessage(Message)
*/
public void onMessage(Message message) {
try {
final MapMessage msg = (MapMessage) message;
log.info("Nome: " + msg.getString("nome"));
log.info("");
log.info("Idade: " + msg.getLong("idade"));
} catch (JMSException e) {
log.error("", e);
} catch (Exception e) {
log.error("", e);
}
}
}