开发者

Change ActiveMQConnectionFactory brokerURL at runtime in grails

I've got a bean defined in resource.groovy like

beans = {
    jmsConnectionFactory(org.apache.activemq.pool.PooledConnectionFactory) {bean ->
        connectionFactory = {org.apache.activemq.ActiveMQConnectionFactory cf ->
            brokerURL = brokerDestination
        }
     }
 }

Now, 开发者_StackOverflow社区is there a way to dynamically change the brokerURL at runtime and therefore also restart the activemq connection?


An easier solution will be to define multiple connection factories for each of your brokers and corresponding bean destinations. You can then swap out the destinations conditionally in your code based on your requirement - there would not be a easy way to go back and modify the bean definitions once the beans have been initialized.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜