ITeye博客

GRAILS JMS (sonicMQ)集成

seanwon · 2009-02-02 17:27 · 技术研究 · 企业架构 · Markdown

网上很多示例都是以activeMQ和openMQ为主,对SonicMQ的配置不多。

下面是针对sonicMQ的配置信息,resources.groovy内容如下: *beans = {

connectionFactory(org.springframework.jndi.JndiObjectFactoryBean){
    jndiTemplate = ref("jndiTemplate")
    jndiName = "testConnectionFactory"
}
jndiTemplate(org.springframework.jndi.JndiTemplate){
    environment =
        
    
}

}*

这里jndiName对应的connectionFactory是在sonicMQ Management Cosole配置的,名字是testConnectionFactory。

接收的程序代码如下:

*class SampleQ1Service {

static expose = 
static destination = "testQueue"
def onMessage(messageObject) {
   println "GOT MESSAGE: $messageObject"
}

} * 监听的Queue的名字是testQueue。 发送的代码如下: *class TestController {

def index = {

    sendJMSMessage("testQueue", "Blog Entry entitled sss has been created.")

}

} *

搞定了。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。