上海高端网站设计,遵义网吧什么时候恢复营业,合肥建站公司排名前十名,手机优化软件哪个好用原文链接 https://logcorner.com/building-micro-services-through-event-driven-architecture-part15-spa-front-end/在本教程中#xff0c;我将展示如何使用angular构建SPA前端来发送命令和请求查询。SPA前端使用commandAPI发送命令#xff08;创建、更新或删除语音#x… 原文链接 https://logcorner.com/building-micro-services-through-event-driven-architecture-part15-spa-front-end/在本教程中我将展示如何使用angular构建SPA前端来发送命令和请求查询。SPA前端使用commandAPI发送命令创建、更新或删除语音然后该命令将传输到Kafka服务总线然后才可用于no-sql数据库 elasticsearch。Query API将使用no-sql数据库elasticsearch来显示新创建的数据在即将发布的教程中我将使用Signalr Notification通知SPA前端更新屏幕要学习本教程您应该熟悉angular。环境变量angular项目包含一个名为environments的文件夹。在这个文件夹中我可以定义环境变量例如environment.test.ts来定义测试环境设置。以下命令将使用测试环境运行构建ng run build –configurationtest在我的演示中我将进入默认环境即 dev (environment.ts)npm run build 会默认使用这个环境。这里我定义了命令Api端点和查询Api端点语音服务SpeechService使用来自angular/common/http的HttpClient服务来发送POST、GET、PUT或DELETE请求SpeechListComponentSpeechListComponent调用SpeechService从查询Api中检索数据SpeechCreateComponentSpeechCreateComponent调用SpeechService向命令Api发送POST数据测试使用本地环境进行测试搭建测试环境需要安装kafkaelastic search https://logcorner.com/building-microservices-through-event-driven-architecture-part12-produce-events-to-apache-kafka/启动zookeeperzookeeper-server-start.bat config\zookeeper.properties启动kafkakafka-server-start.bat config\server.propertieskafka-topics –zookeeper 127.0.0.1:2181 –topic Speech –create –partitions 3 –replication-factor 1启动ElasticSearch 和 Kibanabin/kibanahttp://localhost:5601启动服务总线从此repo克隆代码https://github.com/logcorner/LogCorner.EduSync.Speech.ServiceBus/tree/develop启动命令API从此repo克隆代码https://github.com/logcorner/LogCorner.EduSync.Speech.Command/tree/develop启动查询API从此repo克隆代码https://github.com/logcorner/LogCorner.EduSync.Speech.Query/tree/develop启动前端从此repo克隆代码https://github.com/logcorner/LogCorner.EduSync.Speech.Front/tree/develop使用docker测试创建一个docker网络docker network create speech_network为基础设施kafka、elasticsearch、生产者和消费者构建和运行多容器docker应用程序 ……\LogCorner.EduSync.Speech.ServiceBus\srcdocker-compose build
docker-compose up为命令Apisql server linux 和命令 Api构建和运行多容器docker应用程序 …\LogCorner.EduSync.Speech.Command\srcdocker-compose build
docker-compose up为查询Api构建和运行多容器docker应用程序 ….\LogCorner.EduSync.Speech.Query\srcdocker-compose build
docker-compose up为前端SPAnginx 和 angular 前端构建并运行容器docker应用程序 …….\LogCorner.EduSync.Speech.Front\logcorner-edusync-speechdocker-compose build
docker-compose updocker ps –all –format “table {{.ID}}\t{{.Image}}\t{{.Names}}\t{{.Ports}}”http://localhost:4200/speech代码源可在此处获得https://github.com/logcorner/LogCorner.EduSync.Speech.Front/tree/develophttps://github.com/logcorner/LogCorner.EduSync.Speech.Query/tree/develophttps://github.com/logcorner/LogCorner.EduSync.Speech.Command/tree/develophttps://github.com/logcorner/LogCorner.EduSync.Speech.ServiceBus/tree/develop