Great catch Hiram - that one had me stumped :) On 7/11/06, Hiram Chirino <[EMAIL PROTECTED]> wrote:
Your code is creating 2 message instances. It sends the 2nd one, and the prints out the value from the first.On 7/11/06, Eugene Prokopiev <[EMAIL PROTECTED]> wrote: > > 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 > > -- Regards, Hiram Blog: http://hiramchirino.com
-- James ------- http://radio.weblogs.com/0112098/
