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

个人租用境外服务器seo整站优化哪家专业

个人租用境外服务器,seo整站优化哪家专业,wordpress连接oss,广州软件开发工资怎么样1.什么是Spring Cloud Stream#xff1f; 我看很多回答都是“为了屏蔽消息队列的差异#xff0c;使我们在使用消息队列的时候能够用统一的一套API#xff0c;无需关心具体的消息队列实现”。 这样理解是有些不全面的#xff0c;Spring Cloud Stream的核心是Stream#xf…1.什么是Spring Cloud Stream 我看很多回答都是“为了屏蔽消息队列的差异使我们在使用消息队列的时候能够用统一的一套API无需关心具体的消息队列实现”。 这样理解是有些不全面的Spring Cloud Stream的核心是Stream准确来讲Spring Cloud Stream提供了一整套数据流走向流向的API 它的最终目的是使我们不关心数据的流入和写出而只关心对数据的业务处理 我们举一个例子你们公司有一套系统这套系统由多个模块组成你负责其中一个模块。数据会从第一个模块流入处理完后再交给下一个模块。对于你负责的这个模块来说它的功能就是接收上一个模块处理完成的数据自己再加工加工扔给下一个模块。 我们很容易总结出每个模块的流程 从上一个模块拉取数据处理数据将处理完成的数据发给下一个模块 其中流程1和3代表两个模块间的数据交互这种数据交互往往会采用一些中间件middleware。比如模块1和模块2间数据可能使用的是kafka模块1向kafka中push数据模块2向kafka中poll数据。而模块2和模块3可能使用的是rabbitMQ。很明显它们的功能都是一样的提供数据的流向让数据可以流入自己同时又可以从自己流出发给别人。但由于中间件的不同需要使用不同的API。 为了消除这种数据流入输入和数据流出输出实现上的差异性因此便出现了Spring Cloud Stream。 2.环境准备 采用docker-compose搭建kafaka环境 version: 3networks:kafka:ipam:driver: defaultconfig:- subnet: 172.22.6.0/24services:zookepper:image: registry.cn-hangzhou.aliyuncs.com/zhengqing/zookeeper:latestcontainer_name: zookeeper-serverrestart: unless-stoppedvolumes:- /etc/localtime:/etc/localtimeenvironment:ALLOW_ANONYMOUS_LOGIN: yesports:- 2181:2181networks:kafka:ipv4_address: 172.22.6.11kafka:image: registry.cn-hangzhou.aliyuncs.com/zhengqing/kafka:3.4.1container_name: kafkarestart: unless-stoppedvolumes:- /etc/localtime:/etc/localtimeenvironment:ALLOW_PLAINTEXT_LISTENER: yesKAFKA_CFG_ZOOKEEPER_CONNECT: zookepper:2181KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://10.11.68.77:9092ports:- 9092:9092depends_on:- zookeppernetworks:kafka:ipv4_address: 172.22.6.12kafka-map:image: registry.cn-hangzhou.aliyuncs.com/zhengqing/kafka-mapcontainer_name: kafka-maprestart: unless-stoppedvolumes:- ./kafka/kafka-map/data:/usr/local/kafka-map/dataenvironment:DEFAULT_USERNAME: adminDEFAULT_PASSWORD: 123456ports:- 9080:8080depends_on: - kafkanetworks:kafka:ipv4_address: 172.22.6.13 run docker-compose -f docker-compose-kafka.yml -p kafka up -dkafka-map https://github.com/dushixiang/kafka-map 访问http://127.0.0.1:9080账号密码admin/123456 3.代码工程 实验目标 生成UUID并将其发送到Kafka主题batch-in。从batch-in主题接收UUID的批量消息移除其中的数字并将结果发送到batch-out主题。监听batch-out主题并打印接收到的消息。 pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdparentartifactIdspringcloud-demo/artifactIdgroupIdcom.et/groupIdversion1.0-SNAPSHOT/version/parentmodelVersion4.0.0/modelVersionartifactIdspring-cloud-stream-kafaka/artifactIdpropertiesmaven.compiler.source17/maven.compiler.sourcemaven.compiler.target17/maven.compiler.target/propertiesdependencies!-- Spring Boot Starter Web --dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependency!-- Spring Boot Starter Test --dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-test/artifactIdscopetest/scope/dependencydependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-stream-kafka/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter/artifactId/dependencydependencygroupIdorg.projectlombok/groupIdartifactIdlombok/artifactId/dependency/dependencies/project 处理流 /** Copyright 2023 the original author or authors.** Licensed under the Apache License, Version 2.0 (the License);* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** https://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an AS IS BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/package com.et;import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.kafka.annotation.KafkaListener; import org.springframework.messaging.Message; import org.springframework.messaging.support.MessageBuilder;import java.util.List; import java.util.UUID; import java.util.function.Function; import java.util.function.Supplier;/*** author Steven Gantz*/ SpringBootApplication public class CloudStreamsFunctionBatch {public static void main(String[] args) {SpringApplication.run(CloudStreamsFunctionBatch.class, args);}Beanpublic SupplierUUID stringSupplier() {return () - {var uuid UUID.randomUUID();System.out.println(uuid - batch-in);return uuid;};}Beanpublic FunctionListUUID, ListMessageString digitRemovingConsumer() {return idBatch - {System.out.println(Removed digits from batch of idBatch.size());return idBatch.stream().map(UUID::toString)// Remove all digits from the UUID.map(uuid - uuid.replaceAll(\\d,)).map(noDigitString - MessageBuilder.withPayload(noDigitString).build()).toList();};}KafkaListener(id batch-out, topics batch-out)public void listen(String in) {System.out.println(batch-out - in);}} 定义一个名为stringSupplier的Bean它实现了SupplierUUID接口。这个方法生成一个随机的UUID并打印到控制台表示这个UUID将被发送到batch-in主题。 定义一个名为digitRemovingConsumer的Bean它实现了FunctionListUUID, ListMessageString接口。这个方法接受一个UUID的列表打印出处理的UUID数量然后将每个UUID转换为字符串移除其中的所有数字最后将结果封装为消息并返回。使用KafkaListener注解定义一个Kafka监听器监听batch-out主题。当接收到消息时调用listen方法并打印接收到的消息内容。 配置文件 spring:cloud:function:definition: stringSupplier;digitRemovingConsumerstream:bindings:stringSupplier-out-0:destination: batch-indigitRemovingConsumer-in-0:destination: batch-ingroup: batch-inconsumer:batch-mode: truedigitRemovingConsumer-out-0:destination: batch-outkafka:binder:brokers: localhost:9092bindings:digitRemovingConsumer-in-0:consumer:configuration:# Forces consumer to wait 5 seconds before polling for messagesfetch.max.wait.ms: 5000fetch.min.bytes: 1000000000max.poll.records: 10000000 参数解释 spring:cloud:function:definition: stringSupplier;digitRemovingConsumer spring.cloud.function.definition定义了两个函数stringSupplier和digitRemovingConsumer。这两个函数将在应用程序中被使用。 stream:bindings:stringSupplier-out-0:destination: batch-in stream.bindings.stringSupplier-out-0.destination将stringSupplier函数的输出绑定到Kafka主题batch-in。 digitRemovingConsumer-in-0:destination: batch-ingroup: batch-inconsumer:batch-mode: true stream.bindings.digitRemovingConsumer-in-0.destination将digitRemovingConsumer函数的输入绑定到Kafka主题batch-in。group: batch-in指定消费者组为batch-in这意味着多个实例可以共享这个组来处理消息。consumer.batch-mode: true启用批处理模式允许消费者一次处理多条消息。 digitRemovingConsumer-out-0:destination: batch-out stream.bindings.digitRemovingConsumer-out-0.destination将digitRemovingConsumer函数的输出绑定到Kafka主题batch-out。 以上只是一些关键代码所有代码请参见下面代码仓库 代码仓库 https://github.com/Harries/springcloud-demo(Spring Cloud Stream) 4.测试 启动弄Spring Boot应用可以看到控制台输出日志如下 291ea6cc-1e5e-4dfb-92b6-5d5ea43d4277 - batch-in c746ba4e-835e-4f66-91c5-7a5cf8b01068 - batch-in a661145b-2dd9-4927-8806-919ad258ade5 - batch-in db150918-0f0b-49f6-b7bb-77b0f580de4c - batch-in b0d4917b-6777-4d96-a6d0-bb96715b5b20 - batch-in Removed digits from batch of 5 batch-out - eacc-ee-dfb-b-dead batch-out - cbae-e-f-c-acfb batch-out - ab-dd---adade batch-out - db-fb-f-bbb-bfdec batch-out - bdb--d-ad-bbbb 5.引用 https://github.com/spring-cloud/spring-cloud-stream-samplesSpring Cloud Stream 3.X - coderZoe的博客Spring Cloud Stream实现数据流处理 | Harries Blog™
http://www.zqtcl.cn/news/972336/

相关文章:

  • WordPress建站经验固原市住房和城乡建设厅网站
  • 可以查企业信息的软件wordpress换模板 seo
  • 网站广告怎么做wordpress封面图七牛
  • 设计师网站上海建设银行内部网站6
  • 网站接广告平台wordpress悬浮下拉
  • 国内网站做国外服务器网站建设的cms系统
  • 社交信息共享网站开发外包网站建设规划书的空间
  • 广告网站建设方案沂源网站建设
  • 城建局官网整站seo排名外包
  • 网站运营团队各岗位的职责是什么辽宁建设工程信息网官网首页官方
  • 怎样做网站框架图流媒体网站开发
  • cnzz统计代码放在网站网站建设一般要多钱
  • 长春火车站附近宾馆discuz论坛
  • 洛阳网站建设优惠公司做网站用虚拟主机还是服务器
  • 做自媒体网站需要注册什么公司六安app开发公司
  • 怎么用服务器ip做网站网站建设公司如何发展
  • 网站定位策划制作英文网站案例
  • 台州网站平面设计家装设计学校
  • 做PPT的辅助网站网站建设费属于宣传费吗
  • 湖南网站seo地址北京网站制作公司有哪些
  • 国内最佳网站建设设计emlog转移到wordpress
  • 网站优化怎么做效果才好网络营销工程师
  • 网站微信建设运维经验分享做个网站得多少钱
  • 网站开发设计制作合同静态营销网站代码
  • 中山自助建站系统网站 建设运行情况报告
  • 江西省城乡建设培训网官方网站什么叫静态网站
  • 用vue做网站的实例500个短视频素材免费
  • 免代码开发平台郴州做网站seo
  • 寻找网站设计与制作网站建设不包括以下哪个阶段
  • 网站建设服务合同范本电子商务和网站建设方案