Recreate all connections of spring rabbit CachingConnectionFactory

346 views
Skip to first unread message

sumit jain

unread,
Aug 6, 2015, 3:31:09 AM8/6/15
to rabbitmq-users

I have a CachingConnectionFactory with multiple addresses. When one broker goes down, it connects with the second. Now, when the broker comes up again, I need to destroy existing connections and reconnect to it. But CachingConnectionFactory doesn't have any start, stop methods, instead has only destroy, which will render the factory unusable.


Config:

<bean id="testConnFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
    <property name="addresses" value="rabbit1,rabbit2" />
    <property name="cacheMode" value="CONNECTION" />
    <property name="connectionCacheSize" value="${connection.cache.size}" />
</bean>


Is there any way to do this, programatically?

Michael Klishin

unread,
Aug 6, 2015, 5:52:13 AM8/6/15
to rabbitm...@googlegroups.com, sumit jain
On 6 August 2015 at 10:31:11, sumit jain (sumit...@gmail.com) wrote:
> I have a CachingConnectionFactory with multiple addresses.
> When one broker goes down, it connects with the second. Now, when
> the broker comes up again, I need to destroy existing connections
> and reconnect to it. But CachingConnectionFactory doesn't
> have any start, stop methods, instead has only destroy, which
> will render the factory unusable.

Sumit,

Please post Spring AMQP questions to Stack Overflow, tagged with spring-amqp.
This way the Spring team will notice your question much earlier. This question
is about RabbitMQ and client libraries.

Thank you. 
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


sumit jain

unread,
Aug 6, 2015, 5:58:11 AM8/6/15
to rabbitmq-users, sumit...@gmail.com

Michael, did that before asking here!


I first posted the question there first, but wasn't sure that it would be noticed soon enough.

Thanks,
Sumit
Reply all
Reply to author
Forward
0 new messages