cxf+jms
来源:互联网 发布:网络销售微信聊天 编辑:程序博客网 时间:2024/06/04 20:02
因为CXF(v2.2.3)原生提供的例子不友好,文档也不完整,摸索了几个小时,才发现问题,贴出来共飨。
服务端配置:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:endpoint
xmlns:customer="http://customerservice.service.test/"
id="CustomerService" address="jms://localhost:61616"
serviceName="customer:CustomerServiceService"
endpointName="customer:CustomerServiceEndpoint"
implementor="test.service.impl.CustomerServiceImpl">
<bean class="org.apache.cxf.transport.jms.jmsconfigfeature"
p:jmsConfig-ref="jmsConfig" />
</bean class="org.apache.cxf.transport.jms.jmsconfigfeature"
<bean id="jmsconfig"
class="org.apache.cxf.transport.jms.JMSConfiguration"
p:connectionFactory-ref="jmsConnectionFactory"
p:targetDestination="test.cxf.jmstransport.queue" />
<bean id="jmsconnectionfactory"
class="org.springframework.jms.connection.SingleConnectionFactory">
<bean
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerurl"
value="tcp://localhost:61616" />
</property name="brokerurl"
</property name="targetconnectionfactory"></bean id="jmsconnectionfactory"
</bean id="jmsconfig"
</import resource="classpath:meta-inf></import resource="classpath:meta-inf></import resource="classpath:meta-inf>
客户端配置:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:client id="customerservice"
xmlns:customer="http://customerservice.service.test/"
serviceName="customer:CustomerServiceService"
endpointName="customer:CustomerServiceEndpoint"
address="jms://localhost:61616"
serviceClass="test.service.CustomerService">
<bean xmlns="http: www.springframework.org="" schema="" beans"
class="org.apache.cxf.transport.jms.JMSConfigFeature"
p:jmsConfig-ref="jmsConfig" />
</bean xmlns="http:>
<bean id="jmsconfig"
class="org.apache.cxf.transport.jms.JMSConfiguration"
p:connectionFactory-ref="jmsConnectionFactory"
p:targetDestination="test.cxf.jmstransport.queue" />
<bean id="jmsconnectionfactory"
class="org.springframework.jms.connection.SingleConnectionFactory">
<bean
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerurl"
value="tcp://localhost:61616" />
</property name="brokerurl"
</property name="targetconnectionfactory"></bean id="jmsconnectionfactory"
</bean id="jmsconfig"
</jaxws:client id="customerservice"
</import resource="classpath:meta-inf></import resource="classpath:meta-inf></import resource="classpath:meta-inf>
服务端App:
public class ServerApp {
public static void main(String[] args) {
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
"server-applicationContext.xml");
}
}
客户端App:
public class ClientApp {
/**
* @param args
*/
public static void main(String[] args) {
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(
"client-applicationContext.xml");
CustomerService hello = (CustomerService) applicationContext
.getBean("CustomerService");
System.out.println(hello.getOrder(null).getName());
}
}
Broker:
public final class EmbeddedBroker {
private EmbeddedBroker() {
}
public static void main(String[] args) throws Exception {
BrokerService broker = new BrokerService();
broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
broker.addConnector("tcp://localhost:61616");
broker.start();
System.out.println("JMS broker ready ");
Thread.sleep(125 * 60 * 1000);
System.out.println("JMS broker exiting");
broker.stop();
System.exit(0);
}
}
- cxf+jms
- CXF JMS Transport
- CXF使用JMS作为传输协议的配置
- MAVEN,CXF,设计模式,LINUX SHELL,EJB,JMS
- CXF使用JMS作为传输协议的配置
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- JMS
- jms
- hibernate 中文查询时不执行
- 洛神赋
- Hibernate无法自动创建数据库表
- Ubuntu服务器挂载新硬盘的步骤
- Map集合的遍历
- cxf+jms
- Singleton Pattern ——book review by Mac
- 重新开始新的生活了
- The Unordered List Abstract Data Type
- 运用NDWI指数对高分1号进行水体提取--以matlab为例
- Redis异常调查
- 硬盘的分区和分区格式化类型详解
- xcode iOS 模拟器 textField 鼠标点击后键盘不显示
- AOP--代理模式,拦截器的简易实现及原理