activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: getJMSMessageID on sending message
Date Tue, 11 Jul 2006 15:19:55 GMT
Great catch Hiram - that one had me stumped :)

On 7/11/06, Hiram Chirino <hiram@hiramchirino.com> 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 <prokopiev@stc.donpac.ru> 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/

Mime
View raw message