当前位置: 首页 > news >正文

凡科建站的怎么取消手机网站域名申请后没有做网站

凡科建站的怎么取消手机网站,域名申请后没有做网站,网站服务商查询,软件营销方案Redis协议 特性说明 Redis 是一个高效的 KV 存储服务器。基于 Redis 实现的 RPC 协议。 2.3.0 以上版本支持。 使用场景 缓存,限流,分布式锁等 使用方式 引入依赖 从 Dubbo 3 开始,Redis 协议已经不再内嵌在 Dubbo 中,需要单…

Redis协议

特性说明

Redis 是一个高效的 KV 存储服务器。基于 Redis 实现的 RPC 协议。

2.3.0 以上版本支持。

使用场景

缓存,限流,分布式锁等

使用方式

引入依赖

从 Dubbo 3 开始,Redis 协议已经不再内嵌在 Dubbo 中,需要单独引入独立的模块。

<dependency><groupId>org.apache.dubbo.extensions</groupId><artifactId>dubbo-rpc-redis</artifactId><version>1.0.0</version>
</dependency>

注册 redis 服务的地址

RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension();
Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://10.20.153.10:2181"));
registry.register(URL.valueOf("redis://10.20.153.11/com.foo.BarService?category=providers&dynamic=false&application=foo&group=member&loadbalance=consistenthash"));

在客户端引用

不需要感知 Redis 的地址

在客户端使用:

<dubbo:reference id="store" interface="java.util.Map" group="member" />

或者点对点直连:

<dubbo:reference id="store" interface="java.util.Map" url="redis://10.20.153.10:6379" />

也可以使用自定义接口:

<dubbo:reference id="store" interface="com.foo.StoreService" url="redis://10.20.153.10:6379" />

其中 “p:xxx” 为 spring 的标准 p 标签

<dubbo:reference id="cache" interface="com.foo.CacheService" url="redis://10.20.153.10:6379" p:set="putFoo" p:get="getFoo" p:delete="removeFoo" /

spring boot + Dubbo + Redis注册中心 实现RPC调用


众所周知 dubbo推荐使用zookeeper做服务发现,但今天我们来使用另一种Redis做服务发现 这样省去了维护两种服务的经历 并且可以用作生产

POM

  <dependency><groupId>com.alibaba.spring.boot</groupId><artifactId>dubbo-spring-boot-starter</artifactId><version>2.0.0</version></dependency><!--redis 依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.7</version></dependency>

dubbo server


dubbo server 服务提供者 application.yml

spring:application:name: dubbo-producerdubbo:provider:threadpool: fixedthreads: 2000application:id: server-producername: server-producerqos-enable: trueqos-port: 22222qos-accept-foreign-ip: falseregistry:# 使用redis 注册中心暴露服务地址address: redis://127.0.0.1:6379protocol:name: dubbo# 高效序列化 kryo, fst#用dubbo协议在20880端口暴露服务port: 20884#性能监控中心地址monitor:protocol: dubboaddress: 127.0.0.1:7070scan: cn.itcast.service
server:port: 8888



dubbo服务提供者中创建service接口

public interface IDubboDemoService {String helloDubbo();}


service接口实现

import com.alibaba.dubbo.config.annotation.Service;//@Service(version = "2.0.0")
@DubboService(version = "3.0.0", group = "dev", timeout = 5000)
public class IDubboDemoServiceImpl implements IDubboDemoService {
@Overridepublic String helloDubbo() {return "hello dubbo, 我是提供者";}}

dubbo client

dubbo client服务消费者 application.yml

spring:
application:name: dubbo-consumer
dubbo:provider:threadpool: fixedthreads: 2000application:#      id: database-consumername: database-consumer#      qos-enable: true#      qos-port: 33333#      qos-acceptforeign-ip: falseregistry:#使用redis注册中心暴露服务地址address: redis://127.0.0.1:6379monitor:#      protocol: dubboaddress: 127.0.0.1:7070
server:
port: 9988

dubbo client 服务消费者service接口要与提供者接口名称相同

public interface IDubboDemoService {String helloDubbo();
}    
@Service
public class IDubboDemoServiceImpl implements IDubboDemoService {@Override//该内容随便写public String helloDubbo() {return "hello dubbo, I'm server!";}}


@Service 来自spring依赖

创建自己的接口

public interface IDemoService {String test();
}
@Service
public class DemoServiceImpl implements IDemoService {//调用dubbo服务// @Reference(version = "2.0.0")@DubboReference(version = "3.0.0")public IDubboDemoService dubboDemoService;@Overridepublic String test() {return    dubboDemoService.helloDubbo();}
}



启动类

@SpringBootApplication
@EnableDubbo
@DubboComponentScan(basePackages = "cn.itcast.service")
public class DubboServiceApplication {public static void main(String[] args) {SpringApplication.run(DubboServiceApplication.class,args);}
}

Spring Boot 注解默认只会扫描 main 类所在的 package,如果服务定义在其它 package 中,需要增加配置 EnableDubbo(scanBasePackages = {"org.apache.dubbo.springboot.demo.provider"})

伪代码

@Autowired(required = false)
private IDemoService demoService;
@GetMapper("/get")
demoService.test

即可返回“hello dubbo, 我是提供者”
 

http://www.yayakq.cn/news/196885/

相关文章:

  • 做苗木选择哪个网站商机创业网
  • 黑彩网站建设运营龙岩建设局网站声明
  • php企业网站开发教程网络工程师是干嘛的
  • 营销单页模板网站wordpress怎么搭建用户中心
  • 温州建设集团网站首页兰州广告公司网站建设
  • 建设个人网站赚钱比特币交易网站开发
  • 网站开发创意想法做的好看的外国网站
  • 企业采购网站有哪些下载网站的软件
  • 上海网站建设置作如何制作精美的ppt
  • 安徽省经工建设集团网站如何自己做网站推广
  • 搭建租号网的网站幸运星哪家制作公司
  • html网站地图怎么做一个订阅号
  • 做网站的步骤西安建设工程信息网是谁开发的
  • 国外网站做网站主播搜索引擎营销的四种方式
  • 宁波建网站模板wordpress分类模板
  • 上海哪家公司做网站最好被骗去国外做网站网站推广
  • seo网站诊断报告网站无法发送邮件wordpress
  • 怎么用电脑做网站主机虚拟网站规划与设计
  • 织梦wap网站模版方圆网 网站建设
  • 有经验的武进网站建设工程公司名字大全集
  • 网站制作标准国家企业信用信息查询公示系统广东
  • 石家庄哪个公司做网站好wordpress修改文件上传大小
  • 电子商务网站建设臧良运课后答案宾馆会员卡管理系统
  • 网站建设任职要求深圳500强企业排行榜
  • 深圳专业网站制作多少钱mvc做的游戏网站代码
  • 怎么做存储网站我公司想做网站
  • 天河区门户网站教育局网站开发贴吧
  • 江阴网站优化公司网页设计与制作的原则
  • 网站开发服务税率是多少龙岗网站建设工程
  • 如何做盗版小说网站陕西网站建设维护