我遇到了Rabbitmq和grails的配置问题。我想知道是否有其他人遇到过这种情况。
我在config.groovy中的rabbitmq配置如下所示:
environments {
production {
rabbitmq {
connectionfactory {
username = '******'
password = '******'
hostname = 'ip-******.ec2.internal'
channelCacheSize = 25
prefetchCount = 10
concurrentConsumers = 3
}
retryPolicy {
maxAttempts = 10
}
queues = {
exchange name: 'plover', type: topic, durable: true, {
error durable: true, binding: 'error.#'
user durable: true, binding: 'user.#'
track durable: true, binding: 'track.#'
klout durable: true, binding: 'klout.#'
showuser durable: false, binding: 'showuser.#'
network durable: true, binding: 'network.#'
customer durable: true, binding: 'cusotmer.#'
recommend durable: true, binding: 'recommend.#'
pusher durable: true, binding:'pusher.#'
backfill durable: true, binding: 'backfill.#'
mail durable: true, binding: 'mail.#'
checkaction durable: true, binding: 'checkaction.#'
timertasks durable: true, binding: 'timertasks.#'
mission durable: true, binding: 'mission.#'
sentiment durable: true, binding: 'sentiment.#'
updateuser durable: false, binding: 'updateuser.#'
googlereader durable: true, binding: 'googlereader.#'
flickr durable: true, binding: 'flickr.#'
}
exchange name:'pubsub', type: fanout, durable: true
}
}
}
development {
rabbitmq {
connectionfactory {
username = 'guest'
password = 'guest'
hostname = 'localhost'
channelCacheSize = 25
prefetchCount = 10
concurrentConsumers = 3
}
retryPolicy {
maxAttempts = 10
}
queues = {
exchange name: 'plover', type: topic, durable: true, {
error durable: true, binding: 'error.#'
user durable: true, binding: 'user.#'
track durable: true, binding: 'track.#'
klout durable: true, binding: 'klout.#'
showuser durable: false, binding: 'showuser.#'
network durable: true, binding: 'network.#'
customer durable: true, binding: 'cusotmer.#'
recommend durable: true, binding: 'recommend.#'
pusher durable: true, binding:'pusher.#'
backfill durable: true, binding: 'backfill.#'
mail durable: true, binding: 'mail.#'
checkaction durable: true, binding: 'checkaction.#'
timertasks durable: true, binding: 'timertasks.#'
mission durable: true, binding: 'mission.#'
sentiment durable: true, binding: 'sentiment.#'
updateuser durable: false, binding: 'updateuser.#'
googlereader durable: true, binding: 'googlereader.#'
flickr durable: true, binding: 'flickr.#'
}
exchange name:'pubsub', type: fanout, durable: true
}
}
}
}
因此,所有Rabbitmq配置设置都在生产/开发环境中完成。
但是,当我尝试在生产或本地开发上运行时,我收到以下错误:
2013-04-18 13:23:10,583 [pool-7-thread-1] ERROR RabbitmqGrailsPlugin - RabbitMQ连接工厂设置(rabbitmq.connectionfactory.username, rabbitmq.connectionfactory.password和 rabbitmq.connectionfactory.hostname)必须在Config.groovy中定义
我无法看到我的配置设置如何被破坏。 grails环境配置是否无法正常工作?
麦克
答案 0 :(得分:1)
事实证明我们使用的Groovy版本在ConfigSlurper中有一个错误,可以防止多个环境阻塞。因此,如果您认为config.groovy中可能有多个Environments {Production {} Development {} Test {}}表达式,那么您会看到相当奇怪的行为。
这个bug上有一个Jira。我相信它将在Groovy 2.1中修复,或者如果你想应用这里提供的补丁。我不太相信补丁,所以我将所有不同的环境转换成一个大的表达式(看起来相当丑陋)并解决了问题。