After much testing we've settled on a workaround/solution to this problem. The problem can be solved by setting up the brokers as a "network of brokers". That way the replies would eventually get forwarded to the right broker no matter which broker the producer is sending to. While I think it is more "correct" to implement it as you described, matching the consumer and producer to the same connection, it appears that implementation may be difficult and/or inefficient. Therefore I'm satisfied with our workaround and can consider the issue resolved.
I have a slightly modified working version of the test I sent earlier. Let me know if anyone wants to see it. Thank you for your help. --ming On Nov 23, 2009, at 8:40 AM, Claus Ibsen wrote: > On Mon, Nov 23, 2009 at 1:35 PM, Ming Fang <[email protected]> wrote: >> Thanks for looking into this problem. >> >> According to org.apache.camel.component.jms.JmsProducer.java line 76, >> affinity = RequestorAffinity.PER_PRODUCER; >> This is already the default. >> >> The problem is this case is that the physical connection under the Producer >> changes if left idle for over 30 seconds. >> org.apache.activemq.pool.PooledConnectionFactory.java line 105-112 >> if (connection != null && connection.expiredCheck()) { >> connection = null; >> } >> >> if (connection == null) { >> ActiveMQConnection delegate = createConnection(key); >> connection = createConnectionPool(delegate); >> } >> >> Perhaps this would be less of a problem is ActiveMQ has a way to change the >> idle time. >> I'm going to look into Jencks to see if that can workaround this problem. >> Another workaround is to set randomize=false in the ActiveMQ failover >> transport. >> >> But the fundamental problem remains... >> How can the Requester ensure that it is using the same physical connection >> as the Producer? >> > > Yeah I wonder if it should create both a > - MessageProducer > - MessageConsumer > > when the JmsProducer is sending an InOut message. > Then use the created MessageConsumer to wait for the reply. > > I would then assume they both use the same connection? As they are > created by the same Session. > > > >> >> On Nov 23, 2009, at 6:13 AM, Claus Ibsen wrote: >> >>> Have you tried with the option >>> replyToTempDestinationAffinity=producer >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus
