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

网站开发熬夜么公司注册资金实缴和认缴的区别

网站开发熬夜么,公司注册资金实缴和认缴的区别,泰安人才网招聘网,网站建设广告宣传一 服务降级的说明 1.1 服务降级说明 服务器忙#xff0c;请稍后在试不让客户达等待#xff0c;立即返回一个友好的提示。 1.2 服务降级的触发情况 1.程序运行异常#xff1b; 2.超时#xff1b; 3.服务熔断触发服务降级#xff1b;4 .线程池/信号量打…一 服务降级的说明 1.1 服务降级说明 服务器忙请稍后在试不让客户达等待立即返回一个友好的提示。 1.2 服务降级的触发情况 1.程序运行异常 2.超时 3.服务熔断触发服务降级4 .线程池/信号量打满也会导致服务降级 1.3 通用注解 1.4  hystrix的作用 在springcloud的框架里熔断机制是通过hystrix实现hystrix会监控服务之间的调用。当失败调用达到一定的阈值默认是5s内失败20次就会启用hystrix的熔断机制使用命令HystrixCommand。 二 案例对每一个方法实行降级处理 2.1 消费端 2.1.1 pom文件 !--hystrix--dependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-netflix-hystrix/artifactId/dependency 2.1.2 设置降级规则 代码 GetMapping(value /consumer/payment/nacos/{id})HystrixCommand(fallbackMethod dealFallBackInfo,commandProperties {HystrixProperty(nameexecution.isolation.thread.timeoutInMilliseconds,value1500)})public String paymentInfo(PathVariable(id) Long id){System.out.println(获取服务器配置信息serverUrl:serverURL);System.out.println(9008的controller获取id:id);String strorderConsumerService.getPaymentByIdLjf22222(id);return ok:serverURLstr;}GetMapping(value /consumer/getinfo/{id})public Object getUserInfo(PathVariable(id) Long id){User unew User(id.intValue(),beijingid);return orderConsumerService.postQueryParams(u);}public String dealFallBackInfo(PathVariable(id) Long id){return 我是消费者9008,服务出错了进行服务降级id;} 2.1.3 开启hystrix熔断 添加EnableHystrix 注解 2.2 服务端 2.2.1 pom文件 !--hystrix--dependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-netflix-hystrix/artifactId/dependency 2.2.2 设置降级规则 1.代码 GetMapping(value /ljf/getinfo/{id})HystrixCommand(fallbackMethod dealFallBackInfo,commandProperties {HystrixProperty(nameexecution.isolation.thread.timeoutInMilliseconds,value3000)})public String getPayment(PathVariable(id) Integer id){try {Thread.sleep(5000);} catch (InterruptedException e) {e.printStackTrace();}int k10/0;System.out.println(服务9009 获取到的参数id:id);return 服务9009 获取到的参数id:id;}PostMapping(/path)public String postQueryParams(RequestBody User user) throws JsonProcessingException {String str new JsonMapper().writeValueAsString(user);System.out.println(post提交....);return str;}public String dealFallBackInfo(PathVariable(id) Long id){return 我是消费者9009,服务出错了进行服务降级id;} 2.截图 2.2.3 开启hystrix熔断 2.3 启动服务测试 1.启动nacos启动sleuth 2.启动consumer9008   provider9009 3.测试 三 案例设置全局降级处理办法 3.1 消费端设置 1.代码 package com.ljf.mscloud.controller;import com.ljf.mscloud.model.User; import com.ljf.mscloud.service.OrderConsumerService; import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController;/*** ClassName: OrderConsumerController* Description: TODO* Author: admin* Date: 2023/08/14 18:09:14 * Version: V1.0**/ RestController Slf4j RefreshScope //支持Nacos的动态刷新功能。 //DefaultProperties(defaultFallback globalFallBackInfo) public class OrderConsumerController {Value(${service-url.nacos-user-service})private String serverURL;Autowiredprivate OrderConsumerService orderConsumerService;GetMapping(value /consumer/payment/nacos/{id})HystrixCommand(fallbackMethod dealFallBackInfo,commandProperties {HystrixProperty(nameexecution.isolation.thread.timeoutInMilliseconds,value1500)})public String paymentInfo(PathVariable(id) Long id){System.out.println(获取服务器配置信息serverUrl:serverURL);System.out.println(9008的controller获取id:id);String strorderConsumerService.getPaymentByIdLjf22222(id);return ok:serverURLstr;}GetMapping(value /consumer/getinfo/{id})public Object getUserInfo(PathVariable(id) Long id){User unew User(id.intValue(),beijingid);return orderConsumerService.postQueryParams(u);}public String dealFallBackInfo(PathVariable(id) Long id){return 我是消费者9008,服务出错了进行服务降级id;}public String globalFallBackInfo(){return Global异常处理信息请稍后再试客户端9008;} }2.截图 原因在没有在制定方法加HystrixCommand  那么加上此注解后 再次访问http://localhost:9008/consumer/getinfo/666 四 案例给Feginclient注解的接口上添加降级规则 4.1 controller package com.ljf.mscloud.controller;import com.ljf.mscloud.model.User; import com.ljf.mscloud.service.OrderConsumerService; import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController;/*** ClassName: OrderConsumerController* Description: TODO* Author: admin* Date: 2023/08/14 18:09:14 * Version: V1.0**/ RestController Slf4j RefreshScope //支持Nacos的动态刷新功能。 // //DefaultProperties(defaultFallback globalFallBackInfo) public class OrderConsumerController {Value(${service-url.nacos-user-service})private String serverURL;Autowiredprivate OrderConsumerService orderConsumerService;GetMapping(value /consumer/payment/nacos/{id})// HystrixCommand(fallbackMethod dealFallBackInfo,commandProperties {// HystrixProperty(nameexecution.isolation.thread.timeoutInMilliseconds,value1500)// })public String paymentInfo(PathVariable(id) Long id){System.out.println(获取服务器配置信息serverUrl:serverURL);System.out.println(9008的controller获取id:id);String strorderConsumerService.getPaymentByIdLjf22222(id);return ok:serverURLstr;}GetMapping(value /consumer/getinfo/{id})// HystrixCommandpublic Object getUserInfo(PathVariable(id) Long id){User unew User(id.intValue(),beijingid);// int age 10/0;return orderConsumerService.postQueryParams(u);}public String dealFallBackInfo(PathVariable(id) Long id){return 我是消费者9008,服务出错了进行服务降级id;}public String globalFallBackInfo(){return Global异常处理信息请稍后再试客户端9008;} }4.2 service package com.ljf.mscloud.service;import com.ljf.mscloud.model.User; import feign.Headers; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody;Component FeignClient(value mscloud-fegin-nacos-hystrix-provider9009,fallback PaymentFallbackService.class) public interface OrderConsumerService {GetMapping(value /ljf/getinfo/{yyid}) //相当于public String getPaymentByIdLjf22222(PathVariable(yyid) Long ssid);// Headers({Content-Type: application/json})// PostMapping(/path)PostMapping(value /path,consumes application/json)String postQueryParams(RequestBody User user); }4.3 fallback实现类 Component public class PaymentFallbackService implements OrderConsumerService{Overridepublic String getPaymentByIdLjf22222(Long ssid) {return getPaymentByIdLjf22222方法出现问题开始降级;}Overridepublic String postQueryParams(User user) {return postQueryParams方法出现问题开始降级;} } 4.4 配置文件 4.5 测试 1.故意只启动 consuemr9008不启动provider9009 模拟宕机的情况 2.测试
http://www.pierceye.com/news/710385/

相关文章:

  • 自建公司网站利用网站文件下载做推广
  • 酒店网站素材软件开发合同范本大全
  • 安康市住房和城乡建设局网站网站建设广告宣传素材
  • 没有网站怎么做链接视频网上哪里给公司做网站
  • 广告网站制作报价网站开发环境怎么写
  • 网站开发总结与收获智慧团建登录官网
  • 旅游电子商务网站的建设建设局网站项目负责人资质要求
  • 设计响应式网站多少钱网站建设行业新闻动态
  • 一般做外单的有哪些网站太原市网站制作公司
  • wordpress 文章内seo代码优化工具
  • 做网站用的笔记本配置网络科技公司骗术
  • 在线建设网站江苏中南建设集团网站是多少
  • 中国建设银行官网站陕西西安网站建设域名怎么用
  • 佛山高端网站制作公司自己做的网站怎么发布到百度
  • 网站建设空间选择的重要性wordpress菲插件关键词
  • 基于wap的企业网站设计与实现洛阳霞光seo网络公司
  • 在家做的手工活哪里有网站网站开发与运营方向和企业管理方向
  • 厦门网站建设厦门南京宣传片公司有哪些
  • 专门做问卷的网站南宁做网站公司
  • 鹰潭做网站公司网站模板及素材
  • dw网站引导页怎么做wordpress 福利
  • PS网站设计网站每年都要备案吗
  • 建设通网站账号erp实施顾问
  • 变装小说 wordpress网站建设好怎么优化
  • 苏州网站建设制作开发公司江浦做网站
  • 网站开发哪一门语言更快网站设计方案模板
  • 阿里云做网站需要些什么条件个人博客网站设计模板
  • 更改网站模板内容我赢职场wordpress
  • h5模板下载有哪些网站南京高端网站制作公司
  • 户外旅游网站模板佛山网络优化推广公司