activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sharongi <sginzb...@gmail.com>
Subject Re: Consumer doesnt recieve messages from producer
Date Sat, 19 Sep 2009 09:34:51 GMT

I thank you very much for this response, Tim!

Since I'm not familiar to activemq, can you please reference me to a
tutorial or some documentation, explaining how to use the methods you've
mentioned?

I'll appreciate it greatly!


Timothy Bish wrote:
> 
> On Sat, 2009-09-12 at 07:27 -0700, sharongi wrote:
>> Hi Tim,
>> 
>> Thanks for your answer, but this is not the case.
>> I have another question, regarding the same issue:
>> When I set the MessageListener, how can I "tell" it to run infinitely?
>> I came to notice that the Consumer finishes it's run prior to getting any
>> messages from the Producer.
>> 
>> I'm new to activemq, and while in simple programming I can make the
>> listener
>> thread run in an infinite loop, I have no idea how to do the same here.
>> 
>> I'll appreciate any response and sorry if my question sounds too trivial.
>> 
>> 
> 
> A JMS client doesn't really have any knowledge about what messages it
> should receive from the producer other than what you give it, it can't
> sit and wait for all the messages from a Topic because there isn't
> really a concept of there being N messages that you need on this Topic
> before you are done.  If you want to have you client sit and wait
> forever for a message then use one of the synchronous receive calls in
> the Consumer API, it will cause the consumer to block until it receives
> a message.  If you want the client to run until some console input or
> other even then use the asynchronous method of adding a Message listener
> and have your client code poll the console for input etc.  
> 
> The problem you might be having with you separate Producer / Consumer
> application is that you are starting the consumer after your Producer
> has already finished sending messages to a Topic.  Unless you are using
> retroactive consumers or durable subscriptions a Topic won't retain the
> messages, you'd want to use a Queue for a scenario like that.  
> 
> Regards
> Tim.
> 
> 
>> Timothy Bish wrote:
>> > 
>> > On Wed, 2009-09-09 at 13:40 -0700, sharongi wrote:
>> >> Hello everyone!
>> >> 
>> >> I've created 2 c++ classes: one is functioning as the consumer and one
>> as
>> >> the producer.
>> >> I have 2 c++ projects (A and B), both defined as exe. application.
>> >> I wish that one project will function as the consumer and the other
>> one
>> >> as
>> >> the producer..for that purpose, I added the consumer class to project
>> A
>> >> and
>> >> the producer class to project B.
>> >> In the main class of project A I've started the consumer thread and in
>> >> the
>> >> main class of project B I've started the producer thread.
>> >> >From some reason, the consumer can't seem to get any messages from
>> the
>> >> producer.
>> >> I've tested the exact same code in one project and it worked
>> perfectly.
>> >> Can anyone seem to know what the problem is??
>> > 
>> > The usual culprit for consumers not getting messages is that you did
>> not
>> > call connection.start()
>> > 
>> > Regards
>> > Tim.
>> > 
>> > 
>> > -- 
>> > Tim Bish
>> > http://fusesource.com
>> > http://timbish.blogspot.com/
>> > 
>> > 
>> > 
>> > 
>> > 
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-doesnt-recieve-messages-from-producer-tp25372762p25520024.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message