我正在尝试在我的 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”异常。我无法理解我做错了什么。有人可以帮我解决这个问题吗?谢谢