the connection that is doing tmp.receive(timeout) was started? ( ie: connection.start() )
If a connection is not started it can send but not receive a message. may not be it, but that gets me reasonably often when ever I change connection creation schemes On 4/24/07, James Strachan <[EMAIL PROTECTED]> wrote:
Your code looks fine so not sure the issue. The server side isn't using transacted mode or anything? BTW this might be useful... http://cwiki.apache.org/ACTIVEMQ/how-do-i-send-messages-to-different-destinations-from-a-single-messageproducer.html On 4/24/07, Simon Wistow <[EMAIL PROTECTED]> wrote: > > I seem to have run into some problems with my code and I'm trying to > track down if it's a regression in my code or a change in ActiveMQ that > I didn't notice. > > I'm attempting to send a message to a temporary queue and then wait for > a reply using something like > > > Destination destination; > QueueSession session; > QueueConnection connection; > QueueSender sender; > ActiveMQConnectionFactory connectionFactory; > > connectionFactory = new ActiveMQConnectionFactory(user, pwd, url); > session = connection.createSession(false, ack_mode); > connection = connectionFactory.createQueueConnection(); > destination = session.createQueue(subject); > publisher = session.createSender(destination); > > Queue tmp_queue = session.createTemporaryQueue(); > QueueReceiver tmp = session.createReceiver(tmp_queue); > > Message message = createNewMessage(); > > message.setJMSReplyTo(queue); > sender.send(message); > > Message tmp_mess = (Message) tmp.receive(timeout); > > > The Queue at the other end recieves the message fine and replies using > what appears to be the right queue ID > > > Message reply = createMessage(); > > reply.setJMSCorrelationID(subject); > > Queue reply_queue = (Queue) original_message.getJMSReplyTo(); > QueueSender sender = session.createSender(reply_queue); > sender.send(reply); > > > However tmp.receive(timeout) never gets a message back, it only ever > times out. Changing the methods to use Topic in place of Queue works > absolutely fine. > > I'm pretty sure this code used work - I'm just about to start bisecting > every change however I've also upgraded ActiveMQ from 0.99 to 4.11 so I > wondered if that might have been the cause. > > Any ideas? > > thanks, > Simon > -- James ------- http://macstrac.blogspot.com/