DUBBO-354 增加异步示例
git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@1671 1a56cb94-b969-4eaa-88fa-be21384802f2
This commit is contained in:
parent
7a3d6e61e9
commit
ca28bb6579
|
|
@ -35,7 +35,7 @@ public class AsyncConsumer {
|
|||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config);
|
||||
context.start();
|
||||
|
||||
final AsyncService asyncService = (AsyncService)context.getBean("cacheService");
|
||||
final AsyncService asyncService = (AsyncService)context.getBean("asyncService");
|
||||
|
||||
Future<String> f = RpcContext.getContext().asyncCall(new Callable<String>() {
|
||||
public String call() throws Exception {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|||
public class AsyncProvider {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String config = AsyncProvider.class.getPackage().getName().replace('.', '/') + "/callback-provider.xml";
|
||||
String config = AsyncProvider.class.getPackage().getName().replace('.', '/') + "/async-provider.xml";
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config);
|
||||
context.start();
|
||||
System.in.read();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
package com.alibaba.dubbo.examples.async.api;
|
||||
|
||||
/**
|
||||
* CallbackService
|
||||
* AsyncService
|
||||
*
|
||||
* @author william.liangf
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
||||
|
||||
<dubbo:application name="callback-consumer" />
|
||||
<dubbo:application name="async-consumer" />
|
||||
|
||||
<dubbo:registry address="multicast://224.5.6.7:1234" />
|
||||
|
||||
<dubbo:reference id="callbackService" interface="com.alibaba.dubbo.examples.callback.api.CallbackService" />
|
||||
<dubbo:reference id="asyncService" interface="com.alibaba.dubbo.examples.async.api.AsyncService" />
|
||||
|
||||
</beans>
|
||||
|
|
@ -20,19 +20,14 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
||||
|
||||
<dubbo:application name="merge-provider" />
|
||||
<dubbo:application name="async-provider" />
|
||||
|
||||
<dubbo:registry address="multicast://224.5.6.7:1234" />
|
||||
|
||||
<dubbo:protocol name="dubbo" port="20880" />
|
||||
|
||||
<bean id="callbackService" class="com.alibaba.dubbo.examples.callback.impl.CallbackServiceImpl" />
|
||||
<bean id="asyncService" class="com.alibaba.dubbo.examples.async.impl.AsyncServiceImpl" />
|
||||
|
||||
<dubbo:service interface="com.alibaba.dubbo.examples.callback.api.CallbackService" ref="callbackService" connections="1" callbacks="1000">
|
||||
<dubbo:method name="addListener">
|
||||
<dubbo:argument index="1" callback="true" />
|
||||
<!--<dubbo:argument type="com.demo.CallbackListener" callback="true" />-->
|
||||
</dubbo:method>
|
||||
</dubbo:service>
|
||||
<dubbo:service interface="com.alibaba.dubbo.examples.async.api.AsyncService" ref="asyncService" />
|
||||
|
||||
</beans>
|
||||
|
|
@ -18,7 +18,7 @@ package com.alibaba.dubbo.examples.async.impl;
|
|||
import com.alibaba.dubbo.examples.async.api.AsyncService;
|
||||
|
||||
/**
|
||||
* CallbackServiceImpl
|
||||
* AsyncServiceImpl
|
||||
*
|
||||
* @author william.liangf
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
|
||||
|
||||
<dubbo:application name="merge-provider" />
|
||||
<dubbo:application name="callback-provider" />
|
||||
|
||||
<dubbo:registry address="multicast://224.5.6.7:1234" />
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue