/** * Most of the code in the Qalingo project is copyrighted Hoteia and licensed * under the Apache License Version 2.0 (release version 0.8.0) * http://www.apache.org/licenses/LICENSE-2.0 * * Copyright (c) Hoteia, 2012-2014 * http://www.hoteia.com - http://twitter.com/hoteia - contact@hoteia.com * */ package org.hoteia.qalingo.core.jms.crm.listener; import java.beans.ExceptionListener; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.TextMessage; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.stereotype.Component; @Component(value = "crmQueueListener") public class CrmQueueListener implements MessageListener, ExceptionListener { protected final Log logger = LogFactory.getLog(getClass()); /** * Implementation of <code>MessageListener</code>. */ public void onMessage(Message message) { try { if (message instanceof TextMessage) { TextMessage tm = (TextMessage) message; String valueJMSMessage = tm.getText(); if (logger.isDebugEnabled()) { logger.debug("Processed message, value: " + valueJMSMessage); } } } catch (JMSException e) { logger.error(e.getMessage(), e); } } @Override public void exceptionThrown(Exception e) { logger.debug("Exception on queue listener: " + e.getCause() + ":" + e.getLocalizedMessage()); } }