由于组件使用了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组件使用方法的更多相关文章

  1. React-Native 组件开发方法

    前言 React Native的开发思路是通过组合各种组件来组织整个App,在大部分情况下通过组合View.Image等几个基础的组件,可以非常方便的实现各种复杂的跨平台组件,不过在需要原生功能支持. ...

  2. WPF中实例化Com组件,调用组件的方法时报System.Windows.Forms.AxHost+InvalidActiveXStateException的异常

    WPF中实例化Com组件,调用组件的方法时报System.Windows.Forms.AxHost+InvalidActiveXStateException的异常 在wpf中封装Com组件时,调用组件 ...

  3. 查看 activex 组件的方法

    查看 activex 组件的方法 可以使用的工具COMRaider 直接安装 并选择对应的类型即可查看相关的信息,比OLE/COM Object Viewer 简洁方便. 具体的操作如下: 随意选择一 ...

  4. 解决 window server2008 r2 没有注册Ofiice组件的方法

    解决 window server2008  r2 没有注册Ofiice组件的方法   .NET下在用Microsoft.Office.Interop.Excel及word 操作Excel和Word时, ...

  5. VC中调用COM组件的方法(转载)

    原文参考:http://hi.baidu.com/mingyueye/item/53ebecd44da76917d80e4449 总结一下在VC中调用COM组件的方法 准备及条件: COM服务器为进程 ...

  6. Unity3D 获得GameObject组件的方法

    Unity3D 获得GameObject组件的方法有几种,这里进行说明一下: 组件: 要获得这些组件,进行操作的话,绑定一个Movescipt 的C#组件,里面的获取方法为 void Update ( ...

  7. vc中调用Com组件的方法详解

    vc中调用Com组件的方法详解 转载自:网络,来源未知,如有知晓者请告知我.需求:1.创建myCom.dll,该COM只有一个组件,两个接口:   IGetRes--方法Hello(),   IGet ...

  8. 在javascript中使用com组件的方法

    转载自:  http://dhailin.blog.163.com/blog/static/230738322011128102043880/ 首先创建一个COM组件,插入一个双接口Itest,在此接 ...

  9. 在JS中使用COM组件的方法

    首先创建一个COM组件,插入一个双接口Itest,在此接口上实现以下三个方法: STDMETHODIMP Ctest::test(void) //无输入输出参数 { // TODO: 在此添加实现代码 ...

随机推荐

  1. 免费API 接口罗列,再也不愁没有服务器开发不了APP了(下)【申明:来源于网络】

    免费API 接口罗列,再也不愁没有服务器开发不了APP了(下)[申明:来源于网络] 地址:http://mp.weixin.qq.com/s/QzZTIG-LHlGOrzfdvCVR1g

  2. MSCKF_VIO:MSCKF的双目版本

    论文:MSCKF的双目版本 Robust Stereo Visual Inertial Odometry for Fast Autonomous Flight 下载地址:点击 源码地址:https:/ ...

  3. MySQL常用运算符:算术运算符、比较运算符、逻辑运算符

    (一)  算术运算符 注意: 在除法运算和模运算中,如果除数为0,将是非法除数,返回结果为NULL. div运算符主要是求两个数相除的商 (二)  比较运算符:比较运算符的运算结果为1(条件为真),0 ...

  4. 记一次ADG备库归档目录满导致的延时处理

    报错如下,原因是存放传过来的归档的目录+HWAREDODG满了,MRP进程无法应用归档,我在手动传了几个归档之后发现不是GAP,select * from V$ARCHIVE_GAP 显示没有GAP. ...

  5. 17.2-uC/OS-III消息管理(任务消息队列)

    1.任务的消息队列 uC/OS-III在任务中内建了一个消息队列.用户可以直接发送消息给任务而不通过外部消息队列. 这个特性不仅简化了代码, 还提供了效率.每个任务都内建一个消息队列. uC/OS-I ...

  6. Python时间、日期、时间戳之间的转换

    一.字符串与为时间字符串之间的互相转换 方法:time模块下的strptime方法 a = "2012-11-11 23:40:00" # 字符串转换为时间字符串 import t ...

  7. git忽略规则.gitignore未生效解决办法

    创建git本地的仓库常用命令:git init #初始化--------生成.git文件 配置本地用户名跟邮箱(这样就知道是谁提交的东西)git config --global user.name [ ...

  8. taro中子父传值

    其实网上很多方法,我这只是一个简单的demo,废话不多说直接上代码 import Taro, { Component } from '@tarojs/taro' import { View, Text ...

  9. linux 下tftpf搭建

     什么是TFTP服务 TFTP(Trivial File Transfer Protocol,简单文件传输协议)   是TCP/IP协议族中的一个用来在客户机与服务器之间进行   简单文件传输的协 ...

  10. ssh防止暴力破解之fail2ban

    1.利用sshd服务本身防止暴力破解 2.sshd服务防止暴力破解和fail2ban使用方法 先说说一般的防范措施: 方法1: 1.密码足够复杂: 密码的长度要大于8位最好大于14位.密码的复杂度是密 ...