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: even then odd message ordering
Date Wed, 23 May 2007 08:21:55 GMT
who calls ConsumerImpl.run()?

On 5/22/07, warwick.mayson <warwick.mayson@hp.com> wrote:
>
> hi James
>
> Both the producer and consumers are managed by Spring. They are not run as
> threads, so there is only one instance of each.
>
> The producer test code:
>
> public void testSend() {
>
>         Producer producer =  (Producer)
> Context.instance().getBean("queueProducer");
>         for (int i = 0; i < 100; i++) {
>             String source = "queuemsg-" + i;
>             producer.send(source);
>         }
> }
>
> The consumer message handler test code (ConsumerImpl delgates the handling
> to this class):
>
> public void handle(final Serializable source) {
>         log.debug("==> handle()");
>         log.debug("PARAM|" + "source" + "|" + source);
>
>         this.source = source;
>         log.info(count++ + " handled: " + source);
>
>         log.debug("<== handle()");
> }
>
> Cheers
>
> Warwick
>
>
> James.Strachan wrote:
> >
> > On 5/22/07, warwick.mayson <warwick.mayson@hp.com> wrote:
> >>
> >> Hi
> >>
> >> Thanks for the fast response!
> >>
> >> I am using activemq 4.1.1
> >>
> >> The producer, consumer and activemq conf is attached
> >>
> >> I have test class that simply loops i number of times calling
> >> producer.send("msg#" + i) and the trace on the consumer.onMessage()
> >> method
> >> displays all even numbered messages followed by all odd. The consumer
> >> completes processing one message before handling the next.
> >>
> >> The behavior is consistent and always occurs as described. I initially
> >> thought it may have been synchronization on the logging but i have
> >> retested
> >> persisting each message with no change in behaviour
> >>
> >> Freaky!
> >>
> >> Thanks again
> >>
> >> Warwick http://www.nabble.com/file/p10733989/ConsumerImpl.java
> >> ConsumerImpl.java  http://www.nabble.com/file/p10733989/ProducerImpl.java
> >> ProducerImpl.java
> >> http://www.nabble.com/file/p10733989/activemq-node1.xml
> >> activemq-node1.xml
> >
> > I don't see the code which uses yourr producer & consumer; I suspect
> > thats where the problem is. e.g. I don't see any code which
> > instantiates threads or calls these 2 classes. Any chance you're
> > creating 2 consumer threads or even 2 consumers?
> >
> >
> > --
> > James
> > -------
> > http://macstrac.blogspot.com/
> >
> >
>
> --
> View this message in context: http://www.nabble.com/even-then-odd-message-ordering-tf3787260s2354.html#a10752528
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
James
-------
http://macstrac.blogspot.com/

Mime
View raw message