锁定老帖子 主题:Spring 配置 ActiveMQ
该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2008-06-08
<!-- ////////////////////////////////////////// -->
physicalName="pp.queue.MBSettlementQueue" />
<property name="connectionFactory" ref="jmsConnectionFactory" /> public class SoapGWProducer { /** *define log object to print log record */ private static Log log = LogFactory.getLog(SoapGWProducer.class); /** *define jmsTemplate */ private JmsTemplate jmsTemplate; /** *define destination */ private Queue destination; /** * @return Returns jmsTemplate. */ public JmsTemplate getJmsTemplate() { return jmsTemplate; } /** * @param jmsTemplate The jmsTemplate to set. */ public void setJmsTemplate(JmsTemplate jmsTemplate) { this.jmsTemplate = jmsTemplate; } /** * @return destination */ public Queue getDestination() { return destination; } /** * @param destination destination */ public void setDestination(Queue destination) { this.destination = destination; } /** * send message to queue * @param message message */ public void send(SoapGWMessage message) { try { jmsTemplate.convertAndSend(this.destination, message); } catch (Exception e) { log.error("send SoapGWMessage to SoapGWQueue error:" + e.getMessage(), e); } } } public class SoapGWListener { /** *define log object to print the log content */ private static Log log = LogFactory.getLog(SoapGWListener.class); /** *define start message content */ public static final String START_MESSAGE = "Start"; /** * listerner message and do mblox SoapGWMessage * @param message message */ public void onMessage(SoapGWMessage message) { if (log.isInfoEnabled()) { log.info("start SoapGWListener onMessage(),parameter is:" + message); } //get message informatio String phoneNumber = message.getPhoneNumber(); } activemq.xml <?xml version="1.0" encoding="ISO-8859-1"?> <beans> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <broker xmlns="http://activemq.org/config/1.0" brokerName="localhost"> <persistenceAdapter> <jdbcPersistenceAdapter dataSource="#mssql-ds" useDatabaseLock="false"> <statements> <statements binaryDataType ="binary(1024)"/> </statements> </jdbcPersistenceAdapter> </persistenceAdapter> <!-- Use the following to configure how ActiveMQ is exposed in JMX --> <managementContext> <managementContext connectorPort="1099" jmxDomainName="org.apache.activemq"/> </managementContext> </broker> <bean id="mssql-ds" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="$DB_DRIVERNAME"/> <property name="jdbcUrl" value="$DB_QUEUE_URL"/> <property name="user" value="$DB_QUEUE_USER"/> <property name="password" value="$DB_QUEUE_PASSWD"/> <property name="initialPoolSize" value="50"/> <property name="minPoolSize" value="20"/> <property name="maxPoolSize" value="1000"/> <property name="acquireIncrement" value="30"/> <property name="maxIdleTime" value="100"/> <property name="maxStatements" value="10"/> </bean> </beans>
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2008-09-15
大哥,想问下这个标签“amq:queue”在我这里怎么报错啊?不知道需要导入什么包??麻烦告诉下,谢谢了!
|
|
返回顶楼 | |
发表时间:2008-10-20
tzb2008 写道 大哥,想问下这个标签“amq:queue”在我这里怎么报错啊?不知道需要导入什么包??麻烦告诉下,谢谢了! 不好意思, 很长时间没有到这里来了。 你需要在文件头部加入如下代码: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amq="http://activemq.org/config/1.0"[color=red][/color] xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://activemq.org/config/1.0 http://roy.apache.org/activemq-4.1-working-V4.2.xsd"> |
|
返回顶楼 | |
浏览 5205 次