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

wordpress主题多语言优化是什么意思网络用语

wordpress主题多语言,优化是什么意思网络用语,crm客户管理系统的功能,wordpress菜单修改文章目录 一、概述二、功能三、XML配置使用1、同步调用1.1、pom中添加依赖1.2、为调用方和服务方创建公共接口。1.3、编写业务接口逻辑、创建并启动RPC Server。1.4、创建并执行RPC Client。 2、异步调用2.1、在接口类上加MotanAsync注解2.2、在client端配置motan_client.xml时… 文章目录 一、概述二、功能三、XML配置使用1、同步调用1.1、pom中添加依赖1.2、为调用方和服务方创建公共接口。1.3、编写业务接口逻辑、创建并启动RPC Server。1.4、创建并执行RPC Client。 2、异步调用2.1、在接口类上加MotanAsync注解2.2、在client端配置motan_client.xml时在同步调用配置的基础上只需要修改referer的interface为Motan自动生成的接口类即可。 3、Zookeeper注册中心配置3.1 在server和client中 添加maven依赖3.2 在server和client 的配置文件中分别增加zookeeper registry定义3.3 在Motan client及server配置改为通过registry服务发现。3.4 server程序启动后需要显式调用心跳开关注册到zookeeper。3.5 启动client调用服务 四、注解配置使用server端配置1、声明Annotation用来指定需要解析的包名2、配置ProtocolConfig、RegistryConfig、BasicServiceConfig的bean对象3、service的实现类上添加MotanService注解注解的配置参数与xml配置方式的service标签一致。4、使用spring-boot启动服务 client端配置1、声明Annotation、protocolConfig、RegistryConfig的配置bean。2、配置basicRefererConfig bean3、在使用motan service 的对象上添加MotanReferer注解4、使用spring-boot启动client 一、概述 Motan是一套高性能、易于使用的分布式远程服务调用(RPC)框架。 二、功能 支持通过spring配置方式集成无需额外编写代码即可为服务提供分布式调用能力。 支持集成consul、zookeeper等配置服务组件提供集群环境的服务发现及治理能力。 支持动态自定义负载均衡、跨机房流量调整等高级服务调度能力。 基于高并发、高负载场景进行优化保障生产环境下RPC服务高可用。 文档索引 三、XML配置使用 1、同步调用 1.1、pom中添加依赖 dependencygroupIdcom.weibo/groupIdartifactIdmotan-core/artifactIdversionRELEASE/version/dependencydependencygroupIdcom.weibo/groupIdartifactIdmotan-transport-netty/artifactIdversionRELEASE/version/dependency!-- only needed for spring-based features --dependencygroupIdcom.weibo/groupIdartifactIdmotan-springsupport/artifactIdversionRELEASE/version/dependencydependencygroupIdorg.springframework/groupIdartifactIdspring-context/artifactIdversion4.2.4.RELEASE/version/dependency1.2、为调用方和服务方创建公共接口。 package quickstart;public interface FooService {public String hello(String name); }1.3、编写业务接口逻辑、创建并启动RPC Server。 package quickstart;public class FooServiceImpl implements FooService {public String hello(String name) {System.out.println(name invoked rpc service);return hello name;} }src/main/resources/motan_server.xml ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:motanhttp://api.weibo.com/schema/motanxsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsdhttp://api.weibo.com/schema/motan http://api.weibo.com/schema/motan.xsd!-- service implemention bean --bean idserviceImpl classquickstart.FooServiceImpl /!-- exporting service by Motan --motan:service interfacequickstart.FooService refserviceImpl export8002 / /beanssrc/main/java/quickstart/Server.java package quickstart;import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;public class Server {public static void main(String[] args) throws InterruptedException {ApplicationContext applicationContext new ClassPathXmlApplicationContext(classpath:motan_server.xml);System.out.println(server start...);} }执行Server类中的main函数将会启动Motan服务并监听8002端口. 1.4、创建并执行RPC Client。 src/main/resources/motan_client.xml ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beans xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlns:motanhttp://api.weibo.com/schema/motan xsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsdhttp://api.weibo.com/schema/motan http://api.weibo.com/schema/motan.xsd!-- reference to the remote service --motan:referer idremoteService interfacequickstart.FooService directUrllocalhost:8002/ /beanssrc/main/java/quickstart/Client.java package quickstart;import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;public class Client {public static void main(String[] args) throws InterruptedException {ApplicationContext ctx new ClassPathXmlApplicationContext(classpath:motan_client.xml);FooService service (FooService) ctx.getBean(remoteService);System.out.println(service.hello(motan));} }2、异步调用 异步调用与同步调用基本配置完全一样只需要在接口类中加上MotanAsync注解然后client端稍作修改。server端不需要做任何修改。具体步骤如下 2.1、在接口类上加MotanAsync注解 package quickstart;MotanAsync public interface FooService {public String hello(String name); }编译时 Motan自动生成异步service类生成路径为target/generated-sources/annotations/生成的类名为service名加上Async。 例如 service类名为FooService.java,则自动生成的类名为FooServiceAsync.java。 另外需要将motan自动生产类文件的路径配置为项目source path可以使用maven plugin或手动配置。 pom.xml配置如下 plugingroupIdorg.codehaus.mojo/groupIdartifactIdbuild-helper-maven-plugin/artifactIdversionRELEASE/versionexecutionsexecutionphasegenerate-sources/phasegoalsgoaladd-source/goal/goalsconfigurationsourcessource${project.build.directory}/generated-sources/annotations/source/sources/configuration/execution/executions /plugin2.2、在client端配置motan_client.xml时在同步调用配置的基础上只需要修改referer的interface为Motan自动生成的接口类即可。 motan:referer idremoteService interfacequickstart.FooServiceAsync directUrllocalhost:8002/异步使用方式如下 public static void main(String[] args) {ApplicationContext ctx new ClassPathXmlApplicationContext(new String[] {classpath:motan_client.xml});FooServiceAsync service (FooServiceAsync) ctx.getBean(remoteService);// sync callSystem.out.println(service.hello(motan));// async callResponseFuture future service.helloAsync(motan async );System.out.println(future.getValue());// multi callResponseFuture future1 service.helloAsync(motan async multi-1);ResponseFuture future2 service.helloAsync(motan async multi-2);System.out.println(future1.getValue() , future2.getValue());// async with listenerFutureListener listener new FutureListener() {Overridepublic void operationComplete(Future future) throws Exception {System.out.println(async call (future.isSuccess() ? sucess! value: future.getValue() : fail! exception: future.getException().getMessage()));}};ResponseFuture future3 service.helloAsync(motan async multi-1);ResponseFuture future4 service.helloAsync(motan async multi-2);future3.addListener(listener);future4.addListener(listener); }3、Zookeeper注册中心配置 3.1 在server和client中 添加maven依赖 dependencygroupIdcom.weibo/groupIdartifactIdmotan-registry-zookeeper/artifactIdversionRELEASE/version /dependency3.2 在server和client 的配置文件中分别增加zookeeper registry定义 motan:registry regProtocolzk namemy_zookeeper address127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183/3.3 在Motan client及server配置改为通过registry服务发现。 client motan:referer idremoteService interfacequickstart.FooService registrymy_zookeeper/server motan:service interfacequickstart.FooService refserviceImpl registrymy_zookeeper export8002 /3.4 server程序启动后需要显式调用心跳开关注册到zookeeper。 MotanSwitcherUtil.setSwitcherValue(MotanConstants.REGISTRY_HEARTBEAT_SWITCHER, true)3.5 启动client调用服务 四、注解配置使用 server端配置 1、声明Annotation用来指定需要解析的包名 Beanpublic AnnotationBean motanAnnotationBean() {AnnotationBean motanAnnotationBean new AnnotationBean();motanAnnotationBean.setPackage(com.weibo.motan.demo.server);return motanAnnotationBean;}2、配置ProtocolConfig、RegistryConfig、BasicServiceConfig的bean对象 功能与xml配置中的protocol、registry、basicService标签一致。 Bean(name demoMotan)public ProtocolConfigBean protocolConfig1() {ProtocolConfigBean config new ProtocolConfigBean();config.setDefault(true);config.setName(motan);config.setMaxContentLength(1048576);return config;}Bean(name registryConfig1)public RegistryConfigBean registryConfig() {RegistryConfigBean config new RegistryConfigBean();config.setRegProtocol(local);return config;}Beanpublic BasicServiceConfigBean baseServiceConfig() {BasicServiceConfigBean config new BasicServiceConfigBean();config.setExport(demoMotan:8002);config.setGroup(testgroup);config.setAccessLog(false);config.setShareChannel(true);config.setModule(motan-demo-rpc);config.setApplication(myMotanDemo);config.setRegistry(registryConfig1);return config;}3、service的实现类上添加MotanService注解注解的配置参数与xml配置方式的service标签一致。 MotanService(export demoMotan:8002)public class MotanDemoServiceImpl implements MotanDemoService {public String hello(String name) {System.out.println(name);return Hello name !;}}4、使用spring-boot启动服务 EnableAutoConfigurationSpringBootApplicationpublic class SpringBootRpcServerDemo {public static void main(String[] args) {System.setProperty(server.port, 8081);ConfigurableApplicationContext context SpringApplication.run(SpringBootRpcServerDemo.class, args);MotanSwitcherUtil.setSwitcherValue(MotanConstants.REGISTRY_HEARTBEAT_SWITCHER, true);System.out.println(server start...);}}client端配置 1、声明Annotation、protocolConfig、RegistryConfig的配置bean。 方式与server端配置类似。 2、配置basicRefererConfig bean Bean(name motantestClientBasicConfig)public BasicRefererConfigBean baseRefererConfig() {BasicRefererConfigBean config new BasicRefererConfigBean();config.setProtocol(demoMotan);config.setGroup(motan-demo-rpc);config.setModule(motan-demo-rpc);config.setApplication(myMotanDemo);config.setRegistry(registry);config.setCheck(false);config.setAccessLog(true);config.setRetries(2);config.setThrowException(true);return config;}3、在使用motan service 的对象上添加MotanReferer注解 注册配置与xml方式的referer标签一致 RestControllerpublic class HelloController {MotanReferer(basicReferer motantestClientBasicConfig, group testgroup, directUrl 127.0.0.1:8002)MotanDemoService service;RequestMapping(/)ResponseBodypublic String home() {String result service.hello(test);return result;}}4、使用spring-boot启动client EnableAutoConfigurationSpringBootApplicationpublic class SpringBootRpcClientDemo {public static void main(String[] args) {SpringApplication.run(SpringBootRpcClientDemo.class, args);}}官网文档
http://www.huolong8.cn/news/470101/

相关文章:

  • 铁岭做网站公司哪家好网店装修素材
  • 北京怎样建网站phpcms校园网站
  • 怎样在工商局网站做申请登记电子商务网站设计与维护
  • 在上海做兼职在哪个网站兰州网络推广新手
  • 衡阳市建设学校官方网站网站栏目排序
  • 这么制作自己的网站企业 北京 响应式网站
  • 优仔电话手表网站长沙模板建网站需要多久
  • 昆明做网站竞价河北建筑工程学院招生网官网
  • 沈阳海外模板建站本地网站建设官网
  • 网站建设管理系统查看一个网站的源代码做评价
  • 高端企业网站报价深圳网站设计优异刻
  • 低代码网站开发平台vs 2010 网站建设
  • 福州品牌网站建设oemgoogle权重查询
  • 安庆网站建设公司网站界面需求
  • 网站开发团队人员构成wordpress首页导航代码
  • 学习网站建设建议调查问卷网上购物都有哪些平台
  • 网页设计怎么建站点个人网页设计与实现ppt
  • 做网站需要什么服务器wordpress区块链模板
  • 做网站公司大型餐厅网站建设
  • 建立公司网站关键词排名优化网站建设公司
  • 网站建设大作业论文高端网站设计哪里比较好
  • 3d网站怎么做网站建设条件
  • 水果建设网站前的市场分析wordpress手机网站插件
  • 白石洲附近做网站公司前端开发是做什么
  • 网站悬浮代码上海建设电动车官方网站
  • 做手机网站图品汇免费素材网
  • 如何建微信商城网站漯河装修公司网站建设
  • 广阳区建设局网站网页设计与制作知识点
  • 门户网站有什么特点出版社网站建设方案
  • 网站推广 html关键词代码解说做衣服的网站