You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "warwick.mayson" <wa...@hp.com> on 2007/05/20 23:33:58 UTC

even then odd message ordering

Hi All

I have a simple setup... one producer, one broker one consumer for a single
queue. 

The producer sends numbered TextMessages

The consumer receives all even numbered messages then recieves all odd
numbered messages.

Has anyone else seen this behaviour? Or explain why this is occuring? I can
supply the broker configuration file if that is any help

Thanks in advance

Warwick
-- 
View this message in context: http://www.nabble.com/even-then-odd-message-ordering-tf3787260s2354.html#a10710313
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: even then odd message ordering

Posted by "warwick.mayson" <wa...@hp.com>.

Hey James

Sorry didnt get back to you earlier. Bit frantic. Anyway, I have a test main
class that calls run() 


warwick 


James.Strachan wrote:
> 
> who calls ConsumerImpl.run()?
> 
> On 5/22/07, warwick.mayson <wa...@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 <wa...@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/
> 
> 

-- 
View this message in context: http://www.nabble.com/even-then-odd-message-ordering-tf3787260s2354.html#a10795944
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: even then odd message ordering

Posted by James Strachan <ja...@gmail.com>.
who calls ConsumerImpl.run()?

On 5/22/07, warwick.mayson <wa...@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 <wa...@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/

Re: even then odd message ordering

Posted by "warwick.mayson" <wa...@hp.com>.
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 <wa...@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.


Re: even then odd message ordering

Posted by James Strachan <ja...@gmail.com>.
On 5/22/07, warwick.mayson <wa...@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/

Re: even then odd message ordering

Posted by "warwick.mayson" <wa...@hp.com>.
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 









James.Strachan wrote:
> 
> On 5/20/07, warwick.mayson <wa...@hp.com> wrote:
>>
>> Hi All
>>
>> I have a simple setup... one producer, one broker one consumer for a
>> single
>> queue.
>>
>> The producer sends numbered TextMessages
>>
>> The consumer receives all even numbered messages then recieves all odd
>> numbered messages.
>>
>> Has anyone else seen this behaviour? Or explain why this is occuring? I
>> can
>> supply the broker configuration file if that is any help
> 
> This sounds very strange. Can we see the Java code of your single
> producer & consumer?
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/even-then-odd-message-ordering-tf3787260s2354.html#a10733989
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: even then odd message ordering

Posted by James Strachan <ja...@gmail.com>.
On 5/20/07, warwick.mayson <wa...@hp.com> wrote:
>
> Hi All
>
> I have a simple setup... one producer, one broker one consumer for a single
> queue.
>
> The producer sends numbered TextMessages
>
> The consumer receives all even numbered messages then recieves all odd
> numbered messages.
>
> Has anyone else seen this behaviour? Or explain why this is occuring? I can
> supply the broker configuration file if that is any help

This sounds very strange. Can we see the Java code of your single
producer & consumer?

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