padcom / grails-routing-jms

Apache License 2.0
5 stars 6 forks source link

Consider using camel activemq component documentation example pooled connection spring configuration #3

Open stephen-swensen opened 11 years ago

stephen-swensen commented 11 years ago

We've had issues with connection leaks using the default routing-jms activemq connection management (not actually sure what the defaults are; whether connection pooling is used at all, or whether the pool size is just incredibly high: the defaults allow over 1000 connections to grow when using e.g. dynamic endpoints). The following is a translation of the documentation's example connection pooling spring configuration ((http://camel.apache.org/activemq.html) to the grails spring dsl, consider using this as the default spring configuration shipped with the routing-jms plugin:

jmsConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) {
    brokerURL = application.config.grails.plugin.routing.jms.brokerURL ?: 'vm://LocalBroker'     
}

pooledConnectionFactory(org.apache.activemq.pool.PooledConnectionFactory) { bean ->
    bean.initMethod = 'start'
    bean.destroyMethod = 'stop'
    maxConnections = 8
    connectionFactory = ref('jmsConnectionFactory')
}

jmsConfig(org.apache.camel.component.jms.JmsConfiguration) {
    connectionFactory = ref('pooledConnectionFactory')
    concurrentConsumers = 10
}

activemq(org.apache.activemq.camel.component.ActiveMQComponent) {
    configuration = ref('jmsConfig')
}
padcom commented 11 years ago

Hi,

it makes sense. Could you create a pull request out of it?

M.

2013/1/14 stephen-swensen notifications@github.com

We've had issues with connection leaks using the default routing-jms activemq connection management (not actually sure what the defaults are; whether connection pooling is used at all, or whether the pool size is just incredibly high: the defaults allow over 1000 connections to grow when using e.g. dynamic endpoints). The following is a translation of the documentation's example connection pooling spring configuration ( http://camel.apache.org/activemq.html), consider using this as the default spring configuration shipped with the routing-jms plugin:

jmsConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) { brokerURL = application.config.grails.plugin.routing.jms.brokerURL ?: 'vm://LocalBroker' }

pooledConnectionFactory(org.apache.activemq.pool.PooledConnectionFactory) { bean -> bean.initMethod = 'start' bean.destroyMethod = 'stop' maxConnections = 8 connectionFactory = ref('jmsConnectionFactory') }

jmsConfig(org.apache.camel.component.jms.JmsConfiguration) { connectionFactory = ref('pooledConnectionFactory') concurrentConsumers = 10 }

activemq(org.apache.activemq.camel.component.ActiveMQComponent) { configuration = ref('jmsConfig') }

— Reply to this email directly or view it on GitHubhttps://github.com/padcom/grails-routing-jms/issues/3.