MQ与cxf+spring的应用
?
部分银行项目有用到mq队列管理器用于消息的处理下发,该项目是通过webservice进行连接,下面是具体cxf+spring配置文件:调用只需要把相关的jar包与对应的属性进行修改即可
客户端配置如下:
?
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
xmlns:cxf="http://cxf.apache.org/core"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xmlns:jaxws="http://cxf.apache.org/jaxws"?
xmlns:p="http://www.springframework.org/schema/p"
xmlns:jms="http://cxf.apache.org/transports/jms"
xmlns:wsa="http://cxf.apache.org/ws/addressing"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/jms http://cxf.apache.org/schemas/configuration/jms.xsd" default-lazy-init="true" default-autowire="byName">
<!--p:targetDestination="queue://MQCCC/LOCALQ.SMS.SMSMTSOAP.REQ"
p:replyDestination="queue://MQCCC/LOCALQ.GSP.RSP"-->
<bean id="jmsSmsOutputConfig" />
?
<!--MQ 客户端配置连接信息-->
<bean id="jmsConnectionFactory"
value="SYSTEM.DEF.SVRCONN"></property>
<property name="queueManager" value="MQCCC"></property>
<property name="hostName" value="182.119.171.65"></property>
<property name="port" value="1415"></property>
<property name="CCSID" value="1208"></property>
<property name="transportType" value="1"></property>
</bean>
</property>
<property name="sessionCacheSize" value="4"></property>
</bean>
<jaxws:client id="smsMtService" xmlns:o="http://sms.service.bankcomm.com/Abstraction/Atomic/business.smsmt.SmsMtSOAP"
serviceserviceName="o:SmsMt" endpointName="o:SmsMtSOAP" address="jms://" >
<!--设置拦截器-->
<jaxws:inInterceptors>
<bean value=""/>-->
<jaxws:features>
<bean />
<bean xmlns="http://www.springframework.org/schema/beans"?
/>
<wsa:addressing/>
</jaxws:features>
</jaxws:client>
?
?
</beans>
?
服务器端配置如下:
?
?
<?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:cxf="http://cxf.apache.org/core"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:jms="http://cxf.apache.org/transports/jms"
xmlns:wsa="http://cxf.apache.org/ws/addressing"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/jms http://cxf.apache.org/schemas/configuration/jms.xsd"
default-lazy-init="true" default-autowire="byName">
?
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
?
<import resource="classpath:META-INF/cxf/cxf-extension-local.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-jms.xml" />
?
?
<!-- targetDestination服务端监听的队列属性 ?-->
?
<bean id="jmsSmsSendConfig"
p:maxConcurrentConsumers="1000"
p:wrapInSingleConnectionFactory="true" p:useJms11="true" />
<!-- 服务器端连接配置方式连接 ? ?port:1208 UTF8 ,1380 GBK-->
<bean id="jmsSmsSendConnectionFactory"
value="SYSTEM.DEF.SVRCONN"></property>
<property name="queueManager" value="MQCCC"></property>
<property name="hostName" value="182.119.171.65"></property>
<property name="port" value="1415"></property>
<property name="CCSID" value="1208"></property>
<property name="transportType" value="1"></property>
</bean>
</property>
<property name="sessionCacheSize" value="5"></property>
</bean>
?
<bean name="smsSend"
/>
</property>
</bean>
?
?
<jaxws:endpoint id="smsSendService"
xmlns:customer="http://ccc.service.bankcomm.com/abstraction/atomic/business.SmsSendService/1_0"
implementor="#smsSend" address="jms://">
<jaxws:features>
<wsa:addressing
xmlns:wsa="http://cxf.apache.org/ws/addressing" />
<bean xmlns="http://www.springframework.org/schema/beans"
/>
</jaxws:features>
</jaxws:endpoint>
?
?
</beans>
?
mq相关jar包过大,无法上传
?
1 楼 331008019 2012-04-25 JAVA 代码呢? com.incesoft.commbank.smsservice.output.SmsMt