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

有哪些做特卖的网站电商网站建设商业计划书

有哪些做特卖的网站,电商网站建设商业计划书,杭州建电商网站多少钱,一般的网站开发语言用什么目录 1. sentinel使用场景 2. sentinel组成 3. sentinel dashboard搭建 4. sentinel客户端详细使用 4.1 引入依赖 4.2 application.properties增加dashboard注册地址 4.3 手动增加限流配置类 4.4 rest接口及service类 4.5 通过dashboard动态配置限流规则 1. sentinel使…目录 1. sentinel使用场景 2.  sentinel组成 3. sentinel dashboard搭建 4. sentinel客户端详细使用 4.1 引入依赖 4.2 application.properties增加dashboard注册地址 4.3 手动增加限流配置类 4.4 rest接口及service类 4.5 通过dashboard动态配置限流规则 1. sentinel使用场景 限流、熔断、监控、动态规则配置 2.  sentinel组成 由两部分组成 第一个是dashboard监控仪表盘单独的jar官网下载后启动可监控所有服务、动态发现服务、配置限流策略、熔断等 第二个是sentinel的客户端核心包供微服务引用注册到dashboard仪表盘引入相关pom及设置相关配置即可 3. sentinel dashboard搭建 启动命令 java -Dserver.port8400 -Dcsp.sentinel.dashboard.serverlocalhost:8400 -Dproject.namehj-sentinel -Dsentinel.dashboard.auth.usernamesentinel -Dsentinel.dashboard.auth.passwordsentinel -jar sentinel-dashboard-1.8.6.jar 启动成功地址栏输入localhost:8400, 如图 4. sentinel客户端详细使用 4.1 引入依赖 dependencygroupIdcom.alibaba.cloud/groupIdartifactIdspring-cloud-starter-alibaba-sentinel/artifactIdversion2.2.5.RELEASE/version /dependency 4.2 application.properties增加dashboard注册地址 spring.cloud.sentinel.transport.dashboardlocalhost:8400 4.3 手动增加限流配置类 package hj.example.sampleprovider.sample.config;import com.alibaba.csp.sentinel.slots.block.RuleConstant; import com.alibaba.csp.sentinel.slots.block.flow.FlowRule; import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;import java.util.ArrayList; import java.util.List;/*** Description: sentinel 限流规则配置类**/ Configuration public class SentinelRulesConfig {Beanpublic void initFlowQpsRules() {ListFlowRule rules new ArrayList();FlowRule flowRule new FlowRule();flowRule.setResource(sentinelTest);flowRule.setGrade(RuleConstant.FLOW_GRADE_QPS);flowRule.setCount(1);flowRule.setLimitApp(default);flowRule.setClusterMode(false);flowRule.setControlBehavior(RuleConstant.CONTROL_BEHAVIOR_DEFAULT);rules.add(flowRule);FlowRule flowRule1 new FlowRule();flowRule1.setResource(sayHello);flowRule1.setGrade(RuleConstant.FLOW_GRADE_QPS);flowRule1.setCount(1);flowRule1.setLimitApp(default);flowRule1.setClusterMode(false);flowRule1.setControlBehavior(RuleConstant.CONTROL_BEHAVIOR_DEFAULT);rules.add(flowRule1);FlowRuleManager.loadRules(rules);} }4.4 rest接口及service类 其中sentinelTest为rest接口限流sayHello为方法限流 package hj.example.sampleprovider.sample.controller;import com.alibaba.csp.sentinel.Entry; import com.alibaba.csp.sentinel.SphU; import com.alibaba.csp.sentinel.annotation.SentinelResource; import com.alibaba.csp.sentinel.slots.block.BlockException; import com.alibaba.csp.sentinel.slots.block.RuleConstant; import com.alibaba.csp.sentinel.slots.block.flow.FlowRule; import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager; import com.alibaba.fastjson.JSONObject; import hj.example.sampleprovider.sample.HelloServiceImpl; import hj.example.sampleprovider.sample.config.SentinelRulesConfig; import org.apache.commons.lang.time.DateFormatUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;import java.util.ArrayList; import java.util.Date; import java.util.List;/*** Description: TODO**/ RestController public class SentinelTestController {Autowiredprivate HelloServiceImpl helloService;RequestMapping(/testClean/{id})public ResponseEntityObject testClean(PathVariable(id) String id) {String resultStr String.format(test clean id: %s [%s], id, DateFormatUtils.format(new Date(), yyyy-MM-dd HH:mm:ss ssss));return new ResponseEntity(resultStr , HttpStatus.OK);}RequestMapping(/testSentinelDynamicDashboard)public ResponseEntityObject testSentinelDynamicDashboard() {String resultStr String.format(testSentinelDynamicDashboard [%s], DateFormatUtils.format(new Date(), yyyy-MM-dd HH:mm:ss sss));return new ResponseEntity(resultStr, HttpStatus.OK);}RequestMapping(/sayHello)public ResponseEntityObject sayHelloTest() {String helloStr helloService.sayHello(sayHelloTest);return new ResponseEntity(helloStr, HttpStatus.OK);}SentinelResource(value sentinelTest, blockHandler sentinelTestHandler)RequestMapping(/sentinelTest)public ResponseEntityObject sentinelTest() {System.out.println( sentinelTest : DateFormatUtils.format(new Date(), yyyy-MM-dd HH:mm:ss sss));return new ResponseEntity(sentinelTest , HttpStatus.OK);}public ResponseEntityObject sentinelTestHandler(BlockException e) {System.out.println(被限流了);return new ResponseEntity(sentinelTestHandler 被限流了: JSONObject.toJSONString(e), HttpStatus.OK);} }package hj.example.sampleprovider.sample;import com.alibaba.csp.sentinel.Entry; import com.alibaba.csp.sentinel.SphU; import com.alibaba.csp.sentinel.annotation.SentinelResource; import com.alibaba.csp.sentinel.slots.block.BlockException; import com.alibaba.fastjson.JSON; import hj.example.sample.IHelloService; import org.apache.commons.lang.time.DateFormatUtils; import org.apache.dubbo.config.annotation.DubboService; import org.springframework.beans.factory.annotation.Value; import test.SentinelTest;import javax.xml.bind.ValidationException; import java.util.Date;DubboService public class HelloServiceImpl implements IHelloService {Value(${dubbo.application.name})private String serviceName;SentinelResource(value sayHello, blockHandler sayHelloBlockHandler)public String sayHello(String name) {System.out.printf([%s]: Hello, %s%n, serviceName, name);return String.format([%s]: Hello, %s, serviceName, name);}public String sayHelloBlockHandler(String name, BlockException e) throws ValidationException {System.out.println(sayHello 被限流了。name: name ,被限流了 JSON.toJSONString(e));return sayHello 被限流了。name: name ,被限流了 JSON.toJSONString(e);}public void sentinelTestMethod() {try(Entry entry SphU.entry(sentinelTestMethod)) {System.out.println(hello sentinel : DateFormatUtils.format(new Date(), yyyy-MM-dd HH:mm:ss sss));}catch (BlockException e) {e.printStackTrace();}}public void sentinelTestHandler(BlockException e) throws ValidationException {e.printStackTrace();throw new ValidationException(e.getMessage());} }4.5 通过dashboard动态配置限流规则
http://www.hkea.cn/news/14430544/

相关文章:

  • 男生做污污事的视频网站自助建站网站程序源码
  • 网站外链建设分析如何通过网站开发客户
  • 做追星网站效果图做网站的分析报告案例
  • 免费商城系统网站建设怎么上传自己做的网站
  • 惠州 商城网站建设动画设计就业前景
  • 生物科技 网站模板顺德网站制作案例咨询
  • 福州市建设管理处网站如何建立一个网站论坛
  • 做美图网站有哪些东西眼前一亮的公司名
  • 做一个网站策划山东手机版建站系统哪家好
  • 个人网站设计成品下载苏州住建网
  • 服务器和域名都有了 怎么做网站个性化网站模板
  • 西宁的网站建设公司设计企业门户网站
  • 学校网站管理与建设除了亚马逊还有啥网站做海淘
  • 云南省建设网站网站建设里程碑
  • 网站建设需求分析文档wordpress多个single
  • 查询网站是否过期网站营销型
  • 南皮网站建设公司网站突然404
  • 网站名称怎么起好听大连网站的优化
  • 惠州网站建设找哪个公司电子商务网站建设的成本分析
  • 金融行业高端网站制作now9999网站提示建设中
  • 佛山网站建设慕枫在线营销型网站建设
  • 关于网站建设的教材wordpress安装模板文件
  • 网站建设技术问题免费发布广告的网站
  • 新闻类网站排版网站建设建网站需要什么
  • 文章网站后台浙江+外贸网站建设
  • 女人脱内衣裤给男人做网站营业推广的目标通常是
  • 响应式网站和营销型网站node做网站优势
  • 企业营销型网站案例鞍山建一个网站大概要多少钱
  • 电商网站建设哪好多用户电商平台
  • 公众号搭建第三方平台2014中文网站seo排名名单