素材巴巴 > 程序开发 >

Advanced Java:流程图汇总

程序开发 2023-09-04 11:08:32

Micro Services:

在这里插入图片描述
记住他的架构流程:
Two parts:
Public network and private network. which is the part that User can get accessed to, and the part which they can’t access. (用户可以直接访问的是:Webserver(放代码的地方)+Amazon S3(放用户文件的地方) + API gateway(后端微服务入口))(用户不能直接访问的是:Docker+DB, config server, Discovery server[eureka], log aggregation server, log tracing server[zipkin]) [microserver: docker+DB] all of the dockers are stored in AWS ECR.
User send requests to API gateway, and through ELB(elastic load balancer) 然后我们到了priate network里面,就是我们的后端微服务(几个Dockers+DB 还有一大堆跟着的有用的server[Discovery server+config server+Log aggregation server+log tracing server])
To put it simple, Docker+DB is a micro service. but actually it’s much more than that.

在上面的图中 各个微服务之间的通信和调用 是用discovery server来实现的。
synchronize and asynchronized micro service:
synchronize: caller waiting till get responding, like HTTP request
asynchronized: opposite.

Asynchronous Micro Service:

在这里插入图片描述
Two parts:
Public network, Private network.
in public network, JWT is needed when we get access to API Gateway. apart from that. it’s the same.
in private network, still, [docker+DB] in AWS ECR+ 4 servers(Log aggregation server+ zipkin server, eureka server, config server) [micro services in docker container+4server].
现在这个microserice之间的通信方式变了,之前靠着log tracing和discovery server[eureka]联系,现在需要Messaging system(SQS, Kafka, RabbitMQ)

CI/CD(持续集成和持续交付) pipeline

在这里插入图片描述
注意 这一套流程是一套很大的流程。GIT是完完全全被包含进去的 只占了一小部分。这个PIPELine 实际上就是SDLC-software development life cycle.
0. developers pull the codes down and work

  1. developer push the codes to gitlab o bitbucket
  2. those VCS(version control system) will notify CI/CD tools(Jenkins), pipeline starts.
  3. build+Unit test, Integration,+ report(code coverage, spot bugs)+package(War, Jar, Docker Images) +install and upload +Deploy. [构建-测试集成-报告(测试的代码coverage量,bugs)-打包-上传并部署] 大致分为这五个步骤
  4. 任何一个环节 出了问题 就notify by email.
    其中 在pipeline的环节 大量工具会被用到。Maven-Junit(Mockito)-Jacoco-Maven(SonarQube)-ECR

PipeLine里面的一部分 Git:

在这里插入图片描述

PA: we never touch the master branch in any circumstances.
大致上 是四个角色在交互: remote Dev, local dev, local own branch, developer
六步:

  1. fetch from remote dev to local dev–Fetch
  2. merge it to working dict–merge (??)
  3. create own branch and checkout to that branch.–Checkout
  4. work on own branch, after work, commit new code from working dict o our local branch.–add and commit
  5. local branch merge it to local dev–merge
  6. local dev push to remote dev–push
    上述流程和我之前经常做的有一些出如,因为之间经常每次都直接checkout -b换新的分支。实际上应该Fetch+merge 写完代码再checkout .

在这里插入图片描述

Authentication process:

User try to access Angular client, client will send the login request to Microsoft Azure(OAuth2), then azure will redirect to MS login page. and User will login, if success, auzre will redirect it back to Angular, with that ID-token. and then, angular will try to login to backend server with IdToken.
Backend server will validate the IdToken with Azure, Auzre will confirm it, so Backend server can take it from here. Backend server will check user email and role with DB server, and DB will return it to backend server. and then backend server will create Access Token JWT. and then backend server will use this to acess angular client.
为什么要grant两次token?
这里面关系比较复杂。

在这里插入图片描述

Client和server的关系(client-tomcat-servlet)

Client will send requests and response through HTTP to Tomcat server, and we will transfer them into Java Objects,这些objects存在于作用于servlet classes, developers的工作就是写这些servlet classes来操作这些Objects.

User-Spring flow:

User-Client-Web Server(Tomcat)-Spring(Controller, Service, DAO)-ORM[JPA/Hibernate]-DB
细节一点来说 client一般是browser. client与web server交互HTML、CSS、JS文件 通过HTTP传送 然后Server会calculate并且render代码 并返回broswer显示。

注意 Tomcat的基本组成单位是servlet
User-Spring MVC flow:
一样的flow 但是在Spring MVC里面 我们有个dispatch servlet, 这个是前置控制器 放在web.xml中 拦截并匹配请求。规则可言自己定义。(匹配请求的意思是我们要决定这个请求 由Spring中的哪个controller进行处理)
【servlet是一个program 不是框架 当用户输入URI进行访问 web服务器就会通过servlet来分发请求执行不同的内容。】
【dispatchServlet是SpringMVC的一部分】
servlet和Spring的DispatcherServlet详解

Asynchronous Report Generation

在这里插入图片描述

服务+File storage + DB
服务之间的交互通过AWS SNS/SQS来实现 就像kafka.
这种微服务之间异步通信 不用dicvoery service-eureka,而是用Amazon SQS or SNS(取决于适合publisher-subscribe model还是point to point model).


标签:

上一篇: angular学习笔记(五)组件 下一篇:
素材巴巴 Copyright © 2013-2021 http://www.sucaibaba.com/. Some Rights Reserved. 备案号:备案中。