2019独角兽企业重金招聘Python工程师标准>>>
Apache Dubbo Apache Dubbo™ (incubating)是一款高性能Java RPC框架。下午重新整理一下,纪录下来
1、eclipse 建立一个maven项目
2、建立接口和对应实现类
GreetingService 接口
package dubbolangtutu.dubbolangtutu.service;public interface GreetingService {public String sayHello(String name);
}
GreetingServiceImpl 实现类
package dubbolangtutu.dubbolangtutu.service;public class GreetingServiceImpl implements GreetingService {public String sayHello(String name) {return "Hello " + name;}}
2、新建生产者
package dubbolangtutu.dubbolangtutu;import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import com.alibaba.dubbo.config.ServiceConfig;import dubbolangtutu.dubbolangtutu.service.GreetingService;
import dubbolangtutu.dubbolangtutu.service.GreetingServiceImpl;import java.io.IOException;public class Provider {public static void main(String[] args) throws IOException {ServiceConfig
}
3、新建消费者
package dubbolangtutu.dubbolangtutu;import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ReferenceConfig;
import com.alibaba.dubbo.config.RegistryConfig;import dubbolangtutu.dubbolangtutu.service.GreetingService;public class Consumer {public static void main(String[] args) {ReferenceConfig
}
4、启动zookeeper
5、启动生产者 ,然后启动消费者 查看输出
消费者启动:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Hello world
附件:
https://gitee.com/penggebest/dubbo_demo1