• 大小: 49KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-01-04
  • 语言: 其他
  • 标签: Dubbo  源代码  Maven  

资源简介

Dubbo生产者消费者示例源代码,Eclipse项目,基于Maven构建,可以直接导入Eclipse开发环境,本人亲测,编译通过,可以直接在Eclipse中运行(包含Main方法),先运行提供者,再运行生产者。

资源截图

代码片段和文件信息

package com.alibaba.dubbo.demo.pp;

import org.springframework.context.support.ClassPathxmlApplicationContext;

import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.rpc.RpcContext;
import com.unj.dubbotest.provider.DemoService;

public class Consumer_1 {

public static void main(String[] args) throws Exception {
final ClassPathxmlApplicationContext context = new ClassPathxmlApplicationContext(
new String[] { “applicationContext.xml“ });
context.start();

new Thread(new Runnable() {
public void run() {
try{
while(true){
DemoService demoService = (DemoService) context.getBean(“demoService“);

RpcContext.getContext().setAttachment(Constants.MONITOR_KEY“true“);

String hello = demoService.sayHello(“to

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-11-09 18:04  dubbo-consumer\
     文件         569  2014-11-09 18:07  dubbo-consumer\.classpath
     文件         568  2014-11-05 23:43  dubbo-consumer\.project
     目录           0  2014-11-09 17:52  dubbo-consumer\.settings\
     文件         274  2014-11-05 23:43  dubbo-consumer\.settings\org.eclipse.jdt.core.prefs
     文件         249  2014-11-05 23:43  dubbo-consumer\.settings\org.maven.ide.eclipse.prefs
     文件        1343  2014-11-09 17:58  dubbo-consumer\pom.xml
     目录           0  2014-11-09 17:52  dubbo-consumer\src\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\main\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\main\java\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\main\java\com\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\main\java\com\alibaba\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\main\java\com\alibaba\dubbo\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\main\java\com\alibaba\dubbo\demo\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\main\java\com\alibaba\dubbo\demo\pp\
     文件        1096  2014-11-09 18:04  dubbo-consumer\src\main\java\com\alibaba\dubbo\demo\pp\Consumer_1.java
     目录           0  2014-11-09 17:52  dubbo-consumer\src\main\java\com\unj\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\main\java\com\unj\dubbotest\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\main\java\com\unj\dubbotest\provider\
     文件         168  2014-10-15 10:12  dubbo-consumer\src\main\java\com\unj\dubbotest\provider\DemoService.java
     文件         823  2014-10-15 10:18  dubbo-consumer\src\main\java\com\unj\dubbotest\provider\User.java
     目录           0  2014-11-09 17:52  dubbo-consumer\src\main\resources\
     文件        1240  2014-11-05 23:45  dubbo-consumer\src\main\resources\applicationContext.xml
     文件         213  2014-11-05 23:45  dubbo-consumer\src\main\resources\log4j.properties
     目录           0  2014-11-09 17:52  dubbo-consumer\src\test\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\test\java\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\test\java\neu\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\test\java\neu\lwq\
     目录           0  2014-11-09 17:52  dubbo-consumer\src\test\java\neu\lwq\dubbo_consumer\
     文件         784  2014-11-09 18:03  dubbo-consumer\src\test\java\neu\lwq\dubbo_consumer\TestConsumer.java
     目录           0  2014-11-09 18:04  dubbo-consumer\target\
............此处省略80个文件信息

评论

共有 条评论