activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eugene Prokopiev <prokop...@stc.donpac.ru>
Subject getJMSMessageID on sending message
Date Tue, 11 Jul 2006 10:20:42 GMT
Hi,

Can I get MessageID after message sending? With this code:

import javax.jms.Destination;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;

import org.apache.activemq.ActiveMQConnection;

public class Producer {

	public static void main(String[] args) throws Exception {
		
		ActiveMQConnection connection = 
ActiveMQConnection.makeConnection("producer1", "pw1", 
"tcp://ccsk-mobile:61616");
         	connection.start();
         	Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
         	Destination destination = session.createQueue("monitoring.m1");
         	MessageProducer producer = session.createProducer(destination);

         	String text = "Test Message String";
         	TextMessage message = session.createTextMessage(text);
	    	producer.send(session.createTextMessage());
	    	System.out.println("sent message : "+message.getJMSMessageID());

         	session.close();
         	connection.close();
	}

}

I got:

sent message : null

--
Thanks,
Eugene Prokopiev


Mime
View raw message