我正在尝试在grails应用程序中实现氛围插件。我有以下代码
class AtmosphereService {
static transactional = true
static atmosphere = [mapping: '/atmosphere/status']
static exposes = ['jms']
@Subscriber(topic='msgevent')
def onEvent(msg) {
def payload = msg
if(msg instanceof Map) {
// convert map messages to JSON
payload = msg.encodeAsJSON()
}
// broadcast to the atmosphere
broadcaster['/atmosphere/status'].broadcast(payload)
println("jms service-> "+payload)
/*Broadcaster brod = lookupBroadcaster(msg["id"], false)
brod.broadcast(payload)*/
return null
}
我还添加了onRequest和onStateChange闭包。但我得到一个“嵌套异常是groovy.lang.MissingPropertyException:没有这样的属性:类的广播:com.AtmosphereService”异常。我无法理解我做错了什么。有人可以帮我这个。感谢