首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

activemq spring 调整

2012-12-20 
activemq spring 整合最近的项目需目需要用到activemq ,看了些资料,自己也写了一个简单的demo?Sender用来

activemq spring 整合

最近的项目需目需要用到activemq ,看了些资料,自己也写了一个简单的demo

?

Sender用来发消息

Receiver用来接收消息同时他实现了MessageListener接口

?

?

费话不多说,上代码

applicationContext.xml

?

?看完这个,大家估计就都明白了,哥的demo就是这么简单

?

?

?

?

再来个启动

?

import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;public class SenderTest {    public static void main(String[] args) {        // TODO 自动生成方法存根        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext-jms2.xml");        Sender sender = (Sender) context.getBean("sender");        sender.sendInfo();        System.out.println("send finish");    }}

?

因为把sender和reciever 写在了一个demo里,所以一运行起来,就会打印出结果,呵呵

热点排行