Example usage for javax.jms ObjectMessage setJMSMessageID

List of usage examples for javax.jms ObjectMessage setJMSMessageID

Introduction

In this page you can find the example usage for javax.jms ObjectMessage setJMSMessageID.

Prototype


void setJMSMessageID(String id) throws JMSException;

Source Link

Document

Sets the message ID.

Usage

From source file:eu.learnpad.simulator.mon.probe.GlimpseAbstractProbe.java

/**
 * This method send a {@link GlimpseBaseEvent} message on the ESB<br />
 * specifically on the channel specified in the {@link #settings} object.
 * //w  w w.j  a  v  a 2 s. co  m
 * @param event the event to send
 * @param debug
 * @throws JMSException
 * @throws NamingException
 */
protected void sendEventMessage(GlimpseBaseEventAbstract<?> event, boolean debug)
        throws JMSException, NamingException {
    if (debug) {
        DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(), "Creating Message ");
    }
    try {
        ObjectMessage messageToSend = publishSession.createObjectMessage();
        messageToSend.setJMSMessageID(String.valueOf(MESSAGEID++));
        messageToSend.setObject(event);
        if (debug) {
            DebugMessages.ok();
            DebugMessages.print(TimeStamp.getCurrentTime(), this.getClass().getSimpleName(),
                    "Publishing message  ");
        }
        tPub.publish(messageToSend);
        if (debug) {
            DebugMessages.ok();
            DebugMessages.line();
        }
    } catch (JMSException e) {
        e.printStackTrace();
    }
}