Maybe you can post a JUnit test case? It will be easier for us to diagnose your problem with it.

You could also try running the example producer that is included in the distribution to check if the problem is with your producer.

rabidgremlin wrote:
What should I look out for in the config ?

The broker is an embedded broker, JMX is turned off (conflicts with my
container) and I'm not using any peristence.

Other then that the broker has a single TCP connector added to it...

Jonathan

On 9/12/06, Adrian Co <[EMAIL PROTECTED]> wrote:

Could you post your broker config?

You could also check  your broker via JMX to see if messages are being
received in the topic.


rabidgremlin wrote:
> Yep the producer is working fine. If I run the old version of the code
at
> the same time it receives messages.
>
> Don't have a sample bit of code for the producer that I can post :(
>
> The producer does something a little odd in that it connects and
> disconnects
> from the broker every few messages.
>
> Could this be the problem ?
>
> Jonathan
>
>
> On 9/11/06, Jonas Lim <[EMAIL PROTECTED]> wrote:
>>
>> Can you check that your producer is actually sending messages to the
>> topic
>> after running your consumer?
>>
>> It looks like your code should be able to receive messages from the
>> topic.
>> Could you also post your producer code
>>
>> Regards,
>> Jonas
>>
>>
>> ----- Original Message -----
>> From: "rabidgremlin" <[EMAIL PROTECTED]>
>> To: <[email protected]>
>> Sent: Monday, September 11, 2006 9:35 AM
>> Subject: Re: receive() method not working on TopicSubscriber
>>
>>
>> > yep.... here is the snippet of code of some test code:
>> >
>> > 1)      topicConnection =
topicConnectionFactory.createTopicConnection
>> ();
>> > 2) topicConnection.setExceptionListener(new ExceptionHandler());
>> > 3)      topicSession = topicConnection.createTopicSession(false,
>> > Session.AUTO_ACKNOWLEDGE);
>> > 4)      topic = topicSession.createTopic(topicName);
>> >
>> > 5)      topicSubscriber = topicSession.createSubscriber(topic);
>> > 6)      //topicListener = new TextListener();
>> > 7)      //topicSubscriber.setMessageListener(topicListener);
>> >
>> > 8)      System.out.println("Starting subscriber press CTRL+C to
>> kill");
>> > 9)      topicConnection.start();
>> >
>> > 10)      // now lets wait forever to avoid the JVM terminating
>> immediately
>> > 11)      //Object lock = new Object();
>> > 12)      //synchronized (lock)
>> > 13)      //{
>> > 14)      //  lock.wait();
>> > 15)      //}
>> >
>> > 16)      while (true)
>> > 17)      {
>> > 18)        System.out.println("@@@@ " + topicSubscriber.receive
>> > ().toString());
>> > 19)        //Thread.sleep(1000);
>> > 20)      }
>> >
>> > If I comment out lines 16-20, and uncomment lines 6-7 and 10-15 then
>> > everthing works.....
>> >
>> > On 9/11/06, Jonas Lim <[EMAIL PROTECTED]> wrote:
>> >>
>> >> Hi,
>> >>
>> >> Can you check if you're calling the connection's start method
>> >> (connection.start()) before calling the receive() method?
>> >>
>> >> Regards,
>> >> Jonas
>> >>
>> >>
>> >> ----- Original Message -----
>> >> From: "rabidgremlin" <[EMAIL PROTECTED]>
>> >> To: <[email protected]>
>> >> Sent: Monday, September 11, 2006 7:48 AM
>> >> Subject: receive() method not working on TopicSubscriber
>> >>
>> >>
>> >> > Hi All,
>> >> >
>> >> > I have a piece of code which sets up a TopicSubscriber with a
>> >> > MessageListener. This works fine.
>> >> >
>> >> > I'm now trying to poll the TopicSubscriber instead (it suits my
>> code
>> >> > better).
>> >> >
>> >> > So now my code does not register a listener and simply calls
>> receive()
>> >> on
>> >> > the TopicSubscriber.
>> >> >
>> >> > However this does not work :( The receive() method never returns.
>> >> >
>> >> > What do I need to do differently to get the receive() method to
>> >> > function
>> >> > correctly ?
>> >> >
>> >> > Thanks
>> >> >
>> >> > Jonathan
>> >> >
>> >>
>> >>
>> >
>>
>>
>




Reply via email to