ActiveMQ组件使用方法
由于组件使用了spring,故需要相关的spring包及配置
首先,需要加载对应的jar包

然后,编写调用类
package com.demo.testSpring; import com.jfinal.core.Controller;
import com.jfinal.plugin.spring.Inject;
import com.supermap.sm3dad.messagequeue.CMessageReceiver;
import com.supermap.sm3dad.messagequeue.CMessageSender; public class testSpringController extends Controller{ @Inject.BY_NAME
private CMessageSender messagesender; @Inject.BY_NAME
private CMessageReceiver messagereceiver; public void send(){ messagesender.sendMessage("hello",getPara("info"));
renderNull();
} public void get(){ renderText(messagereceiver.receiveMessage("hello"));
}
}
mq操作示例类
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL">
<value>tcp://localhost:61616?wireFormat.maxInactivityDuration=0</value>
</property>
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref bean="connectionFactory"/>
</property>
</bean>
<bean id="messagesender" class="com.supermap.sm3dad.messagequeue.CMessageSender">
<property name="jmsTemplate" ref="jmsTemplate"/>
<!-- <property name="destination" ref="destination"/> -->
</bean>
<bean id="messagereceiver" class="com.supermap.sm3dad.messagequeue.CMessageReceiver">
<property name="jmsTemplate" ref="jmsTemplate"/>
<!-- <property name="destination" ref="destination"/> -->
</bean> </beans>
spring配置
ActiveMQ组件使用方法的更多相关文章
- React-Native 组件开发方法
前言 React Native的开发思路是通过组合各种组件来组织整个App,在大部分情况下通过组合View.Image等几个基础的组件,可以非常方便的实现各种复杂的跨平台组件,不过在需要原生功能支持. ...
- WPF中实例化Com组件,调用组件的方法时报System.Windows.Forms.AxHost+InvalidActiveXStateException的异常
WPF中实例化Com组件,调用组件的方法时报System.Windows.Forms.AxHost+InvalidActiveXStateException的异常 在wpf中封装Com组件时,调用组件 ...
- 查看 activex 组件的方法
查看 activex 组件的方法 可以使用的工具COMRaider 直接安装 并选择对应的类型即可查看相关的信息,比OLE/COM Object Viewer 简洁方便. 具体的操作如下: 随意选择一 ...
- 解决 window server2008 r2 没有注册Ofiice组件的方法
解决 window server2008 r2 没有注册Ofiice组件的方法 .NET下在用Microsoft.Office.Interop.Excel及word 操作Excel和Word时, ...
- VC中调用COM组件的方法(转载)
原文参考:http://hi.baidu.com/mingyueye/item/53ebecd44da76917d80e4449 总结一下在VC中调用COM组件的方法 准备及条件: COM服务器为进程 ...
- Unity3D 获得GameObject组件的方法
Unity3D 获得GameObject组件的方法有几种,这里进行说明一下: 组件: 要获得这些组件,进行操作的话,绑定一个Movescipt 的C#组件,里面的获取方法为 void Update ( ...
- vc中调用Com组件的方法详解
vc中调用Com组件的方法详解 转载自:网络,来源未知,如有知晓者请告知我.需求:1.创建myCom.dll,该COM只有一个组件,两个接口: IGetRes--方法Hello(), IGet ...
- 在javascript中使用com组件的方法
转载自: http://dhailin.blog.163.com/blog/static/230738322011128102043880/ 首先创建一个COM组件,插入一个双接口Itest,在此接 ...
- 在JS中使用COM组件的方法
首先创建一个COM组件,插入一个双接口Itest,在此接口上实现以下三个方法: STDMETHODIMP Ctest::test(void) //无输入输出参数 { // TODO: 在此添加实现代码 ...
随机推荐
- ArcPy第一章-Python基础
学习Arcpy,从零开始积累.1.代码注释: python中,说明部分通常使用注释来实现: 方式: # 或者 ## + 注释部分内容2. 模块导入: 方式: import Eg: import arc ...
- Parallel.ForEach 多线程 声明失败 "未将对象引用设置到对象的实例"
x using System; using System.Collections.Generic; namespace Parallel.ForEach { class Program { //代码结 ...
- the pitfull way to create a uClinux image including gdb.
After downloaded and installed the GCT's SDK and toolchain, we try to make an our own image which in ...
- qt opencv编译错误 /usr/local/lib/libopencv_imgcodecs.so.3.1:-1: error: error adding symbols: DSO missing from command line
转载自:http://tbfungeek.github.io/2016/03/05/Opencv-%E5%AE%89%E8%A3%85%E8%BF%87%E7%A8%8B%E4%B8%AD%E5%87 ...
- echart 判断数据是否为空
formatter 判断数据是否为空
- linux 日常运维 目录
Linux防火墙:iptables Linux 抓包工具:tcpdump linux 查看磁盘读写:iotop linux 查看磁盘读写:iostat inux 查看网卡流量:sar linux 查看 ...
- 《Java程序设计》 第四周学习总结
学号 20175313 <Java程序设计>第四周学习总结 教材学习内容总结 第五章主要内容 了解子类的继承性 子类和父类在同一包中的继承性(除private外其余都继承) 子类和父类不在 ...
- 012-mac下shell,zsh,oh-my-zsh,以及插件
1.查看当前shell echo $SHELL 2.查看安装的shell cat /etc/shells 查看可知 /bin/bash /bin/csh /bin/ksh /bin/sh /bin/t ...
- 对String中固定符号隔开的每项做无序不重复监测
Response<List<String[]>> response = new Response<>(); // 引擎方式校验 // 在此对知识内容标签进行打标 t ...
- 如何用VSCode手动编译Ace Editor
对于习惯微软VS的用户,可能很不习惯开源社区兴起的前端开发流程.随着NodeJs的兴起,JavaScript已经成为Github上开源项目最多的语言.使用微软提供的VSCode可以很好地利用这些开源项 ...