Bluelock / camel-spring-amqp

Spring AMQP Component for Apache Camel
61 stars 54 forks source link

SpringAMQPProducer should implement ServicePoolAware #55

Open drasil opened 10 years ago

drasil commented 10 years ago

Hello,

recently I noticed that new SpringAMQPProducer instances are created quite often in my application. But creating a new producer instance is not a cheap operation as it includes (re)declaring an AMQP exchange and creating a threadpool. After some investigation I fould out that the creation is initiated by the org.apache.camel.impl.ProducerCache.doGetProducer() method. This method could reuse producer instances, but it is currently not allowed by SpringAMQPProducer because it does not implement the org.apache.camel.ServicePoolAware marker interface. I am not 100 % sure, but I can not see any reason for not implementing this interface. What is your position on this?

Maybe, implementing this interface should be considered for other classes as well.

Pavel

nfx commented 9 years ago

i would also raise priority for this issue.

implementing singleton support would be good as well.

nfx commented 9 years ago

Just in case, it's possible to extend SpringAMQPComponent class and register it in spring under spring-amqp bean without need to wait for features to appear in this repo

janzankowski commented 9 years ago

+1 to implementing this request. The first thing I noticed after starting to use camel-spring-amqp is that the framework tries to re-declare my AMQP exchanges on every request ("INFO SpringAMQPProducer:72 - Declaring exchange [...]"), because every requests starts a new SpringAMQPProducer. This seems very wasteful and makes me want to reconsider using this library...