Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #9 from davidtinker/GPRABBITMQ-26

Implementation of GPRABBITMQ-26
  • Loading branch information...
commit 5950c03a73416ce7300ae26aa1b55cf5cf8e0539 2 parents 8ddb5e6 + a27d4c8
Jeff Scott Brown jeffbrown authored
5 RabbitmqGrailsPlugin.groovy
View
@@ -61,6 +61,8 @@ class RabbitmqGrailsPlugin {
def connectionFactoryHostname = connectionFactoryConfig?.hostname
def connectionChannelCacheSize = connectionFactoryConfig?.channelCacheSize ?: 10
+ def messageConverterBean = rabbitmqConfig.messageConverterBean
+
if(!connectionFactoryUsername || !connectionFactoryPassword || !connectionFactoryHostname) {
log.error 'RabbitMQ connection factory settings (rabbitmq.connectionfactory.username, rabbitmq.connectionfactory.password and rabbitmq.connectionfactory.hostname) must be defined in Config.groovy'
} else {
@@ -82,6 +84,7 @@ class RabbitmqGrailsPlugin {
}
rabbitTemplate(RabbitTemplate) {
connectionFactory = rabbitMQConnectionFactory
+ if (messageConverterBean) messageConverter = ref(messageConverterBean)
}
adm(RabbitAdmin, rabbitMQConnectionFactory)
Set registeredServices = new HashSet()
@@ -220,12 +223,14 @@ class RabbitmqGrailsPlugin {
}
def doWithApplicationContext = { applicationContext ->
+ def rabbitTemplate = applicationContext.getBean('rabbitTemplate', RabbitTemplate.class)
def containerBeans = applicationContext.getBeansOfType(SimpleMessageListenerContainer)
containerBeans.each { beanName, bean ->
if(beanName.endsWith(LISTENER_CONTAINER_SUFFIX)) {
def adapter = new MessageListenerAdapter()
def serviceName = beanName - LISTENER_CONTAINER_SUFFIX
adapter.delegate = applicationContext.getBean(serviceName)
+ adapter.messageConverter = rabbitTemplate.messageConverter
bean.messageListener = adapter
// Now that the listener is properly configured, we can start it.
1  src/groovy/org/grails/rabbitmq/RabbitQueueBuilder.groovy
View
@@ -52,6 +52,7 @@ class RabbitQueueBuilder {
case FanoutExchange:
// Any binding will be ignored.
log.warn "'${currentExchange.name}' is a fanout exchange - binding for queue '${methodName}' ignored"
+ newBinding.rule = "" // rabbit client API doesn't like a null binding
break
case HeadersExchange:
Please sign in to comment.
Something went wrong with that request. Please try again.