Example usage for javax.jms MapMessage getString

List of usage examples for javax.jms MapMessage getString

Introduction

In this page you can find the example usage for javax.jms MapMessage getString.

Prototype


String getString(String name) throws JMSException;

Source Link

Document

Returns the String value with the specified name.

Usage

From source file:org.apache.falcon.regression.core.util.Util.java

/**
 * Prints JMSConsumer messages content.//from  w  ww  .j av a2  s  .  co m
 * @param messageConsumer the source JMSConsumer
 * @throws JMSException
 */
public static void printMessageData(JmsMessageConsumer messageConsumer) throws JMSException {
    LOGGER.info("dumping all queue data:");
    for (MapMessage mapMessage : messageConsumer.getReceivedMessages()) {
        StringBuilder stringBuilder = new StringBuilder();
        final Enumeration mapNames = mapMessage.getMapNames();
        while (mapNames.hasMoreElements()) {
            final String propName = mapNames.nextElement().toString();
            final String propValue = mapMessage.getString(propName);
            stringBuilder.append(propName).append('=').append(propValue).append(' ');
        }
        LOGGER.info(stringBuilder);
    }
}

From source file:com.it.j2ee.modules.jms.simple.NotifyMessageListener.java

/**
 * MessageListener./*from w  w w . j  a  v  a  2s.c  om*/
 */
public void onMessage(Message message) {
    try {
        MapMessage mapMessage = (MapMessage) message;
        // ??
        logger.info("UserName:{}, Email:{}", mapMessage.getString("userName"), mapMessage.getString("email"));

        // ??
        if (simpleMailService != null) {
            simpleMailService.sendNotificationMail(mapMessage.getString("userName"));
        }
    } catch (Exception e) {
        logger.error("???.", e);
    }
}

From source file:com.vnet.demo.config.NoteMessageListener.java

@Override
public void receive(Message message) {
    MapMessage mapMessage = (MapMessage) message;
    try {/*from   www  .j ava2  s  . c o m*/
        Long id = mapMessage.getLong("ID");
        String opr = mapMessage.getString("OPR");

        noteService.syncNoteToIndex(id, opr);
    } catch (JMSException e) {
        e.printStackTrace();
    }
}

From source file:org.springside.examples.quickstart.jms.NotifyMessageListener.java

/**
 * MessageListener./*ww w . j  a v a 2  s .  com*/
 */
@Override
public void onMessage(Message message) {
    try {
        MapMessage mapMessage = (MapMessage) message;
        // ??
        logger.info("UserName:{}, Email:{}", mapMessage.getString("userName"), mapMessage.getString("email"));

        // ??
        //         if (simpleMailService != null) {
        //            simpleMailService.sendNotificationMail(mapMessage.getString("userName"));
        //         }
    } catch (Exception e) {
        logger.error("???.", e);
    }
}

From source file:com.oakhole.core.jms.NotifyMessageListener.java

/**
 * MessageListener.//  ww  w .  j  av a 2 s .c  o m
 */
@Override
public void onMessage(Message message) {
    try {
        MapMessage mapMessage = (MapMessage) message;
        // ??
        logger.info("UserName:{}, Email:{}", mapMessage.getString("username"), mapMessage.getString("email"));

        // ??
        if (simpleMailService != null) {
            simpleMailService.sendNotificationMail(mapMessage.getString("username"));
        }
    } catch (Exception e) {
        logger.error("???.", e);
    }
}

From source file:com.xyxy.platform.examples.showcase.demos.jms.simple.NotifyMessageListener.java

/**
 * MessageListener./*from  ww w . j  av  a 2  s.  c  o m*/
 */
@Override
public void onMessage(Message message) {
    try {
        MapMessage mapMessage = (MapMessage) message;
        // ??
        logger.info("UserName:{}, Email:{}", mapMessage.getString("userName"), mapMessage.getString("email"));

        // ??
        if (simpleMailService != null) {
            simpleMailService.sendNotificationMail(mapMessage.getString("userName"));
        }
    } catch (Exception e) {
        logger.error("???.", e);
    }
}

From source file:com.santika.hendi.activeMQ.MessageConsumerBean.java

public MessageObject receiveMessage() {
    MapMessage message = (MapMessage) jmsTemplate.receive(destination);
    try {/*from  w w w .  ja  v  a2  s.c  om*/
        MessageObject messageObj = new MessageObject();
        messageObj.setMailId(message.getString("mailId"));
        messageObj.setMessage(message.getString("message"));
        return messageObj;
    } catch (JMSException e) {
        throw JmsUtils.convertJmsAccessException(e);
    }
}

From source file:edu.harvard.i2b2.crc.ejb.QueryLargeExecutorMDB.java

/**
 * Take the XML based message and delegate to 
 * the system coordinator to  handle the 
 * actual processing//www.ja va2  s  . co  m
 * @param msg th JMS TextMessage 
 *             object containing XML data
 */
public void onMessage(Message msg) {
    MapMessage message = (MapMessage) msg;
    try {
        log.info("Executing from Large queue for query instance [ "
                + message.getString(QueryManagerBeanUtil.QUERY_INSTANCE_ID_PARAM) + " ]");
    } catch (JMSException e) {
        e.printStackTrace();
    }
    //call executor mdb class with this session context
    QueryExecutorMDB queryMdb = new QueryExecutorMDB(sessionContext, QueryExecutorMDB.LARGE_QUEUE);
    queryMdb.onMessage(msg);

}

From source file:edu.harvard.i2b2.crc.ejb.QueryMediumExecutorMDB.java

/**
 * Take the XML based message and delegate to 
 * the system coordinator to  handle the 
 * actual processing/*w  ww . ja v a2  s .  co m*/
 * @param msg th JMS TextMessage 
 *             object containing XML data
 */
public void onMessage(Message msg) {
    MapMessage message = (MapMessage) msg;
    try {
        log.info("Executing from Medium queue for query instance [ "
                + message.getString(QueryManagerBeanUtil.QUERY_INSTANCE_ID_PARAM) + " ]");
    } catch (JMSException e) {
        e.printStackTrace();
    }
    //call executor mdb class with this session context
    QueryExecutorMDB queryMdb = new QueryExecutorMDB(sessionContext, QueryExecutorMDB.MEDIUM_QUEUE);
    queryMdb.onMessage(message);

}

From source file:com.adaptris.core.jms.MapMessageTranslator.java

/**
 * <p>/*from  w  w  w.j av a2  s  . c  om*/
 * Translates a MapMessage into an {@link com.adaptris.core.AdaptrisMessage}.
 * </p>
 *
 * @param msg the <code>MapMessage</code> to translate
 * @return an <code>AdaptrisMessage</code>
 * @throws JMSException
 */
public AdaptrisMessage translate(Message msg) throws JMSException {
    MapMessage jmsMsg = (MapMessage) msg;
    AdaptrisMessage result = currentMessageFactory().newMessage(jmsMsg.getString(getKeyForPayload()));
    Enumeration e = jmsMsg.getMapNames();
    while (e.hasMoreElements()) {
        String mapName = (String) e.nextElement();
        if (!mapName.equals(getKeyForPayload())) {
            result.addMetadata(mapName, jmsMsg.getString(mapName));
        }
    }
    return helper.moveMetadata(msg, result);
}