|
From: <jas...@ma...> - 2004-10-28 14:37:03
|
On 28 Oct 2004, at 09:52, j=FCrgen h=F6ller [werk3AT] wrote: > If there's an actual need to pool those target listeners, this could =20= > always be achieved through a ProxyFactoryBean with a pooling =20 > TargetSource, with the proxy implementing the MessageListener =20 > interface: =46rom the point of view of the ActiveMQ message = dispatcher, =20 > it would simply keep calling the shared MessageListener onMessage =20 > method, but this time on the proxy which will delegate to one of the =20= > instances in its backend pool. I went a head and refactored to just use a MessageListener and so then =20= its up to the MessageListener instance to handle pooling - if its =20 needed. This makes the code much cleaner - great suggestion j=FCrgen. I tried using the ProxyFactoryBean. Firstly this introduced a new =20 runtime dependency on cglib. Secondly it created this exception.. org.springframework.beans.factory.BeanCreationException: Error creating =20= bean with name 'inboundMessageB' defined in class path resource =20 [spring-with-proxyfactory.xml]: Can't resolve reference to bean =20 'pooledEchoBean' while setting property 'messageListener'; nested =20 exception is org.springframework.beans.factory.BeanCreationException: =20= Error creating bean with name 'pooledEchoBean' defined in class path =20 resource [spring-with-proxyfactory.xml]: Initialization of bean failed; =20= nested exception is org.aopalliance.aop.AspectException: null org.springframework.beans.factory.BeanCreationException: Error creating =20= bean with name 'pooledEchoBean' defined in class path resource =20 [spring-with-proxyfactory.xml]: Initialization of bean failed; nested =20= exception is org.aopalliance.aop.AspectException: null java.lang.IllegalStateException: Unknown callback class =20 org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedIntercept=20= or at =20 net.sf.cglib.proxy.CallbackUtils.getGenerator(CallbackUtils.java:102) The XML config file I was using is here... http://cvs.activemq.codehaus.org/viewrep/activemq/activemq/modules/=20 container/src/test/org/codehaus/activemq/jca/spring-with-=20 proxyfactory.xml?r=3D1.1 and the test case is JCAContainerWithProxyFactoryTest. Any ideas why I get this error? Its OK to use a ProxyFactoryBean with a =20= pooled TargetSource without using any AOP advice right? As a work around and to avoid the cglib dependency, I've added a little =20= TargetSourceMessageListener helper class which works in a similar =20 way... http://cvs.activemq.codehaus.org/viewrep/activemq/activemq/modules/=20 container/src/test/org/codehaus/activemq/jca/spring.xml?r=3D1.3 In terms of simplicity in the XML configuration file they're of similar =20= order. Incidentally there's also an XA based test case to show how to use XA =20= based message consumption; you basically just ocnfigure the =20 TransactionManager to use. http://cvs.activemq.codehaus.org/viewrep/activemq/activemq/modules/=20 container/src/test/org/codehaus/activemq/jca/spring-with-xa.xml?r=3D1.1 In this particular test case, JCAContainerUsingXATest we just use =20 JOTM directly. James ------- http://radio.weblogs.com/0112098/ |