mermaid test

classDiagram
    Animal <|-- Duck
    Animal <|-- Fish
    Animal <|-- Zebra
    Animal : +int age
    Animal : +String gender
    Animal: +isMammal()
    Animal: +mate()
    class Duck{
      +String beakColor
      +swim()
      +quack()
    }
    class Fish{
      -int sizeInFeet
      -canEat()
    }
    class Zebra{
      +bool is_wild
      +run()
    }
zenuml

@Client "Client"
@APIGateway "API Gateway"
@AuthService "Auth Service"
@BackendService "Backend Service"

Client -> APIGateway.sendRequest(){
  APIGateway -> AuthService.validateToken(){
    if(tokenValid){
      @return AuthService -> APIGateway: token valid
    }
  }
  
  if(authenticated){
    APIGateway -> BackendService.processRequest(){
      // (green) Processing the business logic
      BackendService -> BackendService.processData()
      @return BackendService -> APIGateway: processed response
    }
    
    @return APIGateway -> Client: success response
  } else {
    @return APIGateway -> Client: unauthorized error
  }
}
zenuml
    title Order Service
    @Actor Client #FFEBE6
    @Boundary OrderController #0747A6
    @EC2 <<BFF>> OrderService #E3FCEF
    group BusinessService {
      @Lambda PurchaseService
      @AzureFunction InvoiceService
    }

    @Starter(Client)
    // `POST /orders`
    OrderController.post(payload) {
      OrderService.create(payload) {
        order = new Order(payload)
        if(order != null) {
          par {
            PurchaseService.createPO(order)
            InvoiceService.createInvoice(order)      
          }      
        }
      }
    }
zenuml
    // An example for a RESTful endpoint<br>
    // Go to the "Cheat sheet" tab or https://docs.zenuml.com
    // to find all syntax<br>
    // `POST /v1/book/{id}/borrow`
    BookLibService.Borrow(id) {
    User = Session.GetUser()
    if(User.isActive) {
        try {
        BookRepository.Update(id, onLoan, User)
        receipt = new Receipt(id, dueDate)
        } catch (BookNotFoundException) {
        ErrorService.onException(BookNotFoundException)
        } finally {
        Connection.close()
        }
    }
    return receipt
    }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
         ┌─┐                                                                                                                                                                      
"│
└┬┘
┌┼┐
│ ┌────────────────┐ ┌────────────────────┐ ┌───────────┐ ┌─────────────────┐ ┌────┐
┌┴┐ │Spring Container│ │BeanDefinitionReader│ │BeanFactory│ │BeanPostProcessor│ │Bean│
应用程序 └────────┬───────┘ └──────────┬─────────┘ └─────┬─────┘ └────────┬────────┘ └──┬─┘
│ 请求应用上下文 │ │ │ │ │
│──────────────────────────────>│ │ │ │ │
│ │ │ │ │ │
│ │ 加载Bean定义 │ │ │ │
│ │─────────────────────────────>│ │ │ │
│ │ │ │ │ │
│ │ 返回Bean定义 │ │ │ │
│ │<─────────────────────────────│ │ │ │
│ │ │ │ │ │
│ │ 创建Bean实例 │ │ │
│ │─────────────────────────────────────────────────────────>│ │ │
│ │ │ │ │ │
│ │ │ │ 实例化Bean │
│ │ │ │──────────────────────────────────────────────────────────────────>│
│ │ │ │ │ │
│ │ │ │调用BeanPostProcessor (初始化前) │ │
│ │ │ │────────────────────────────────>│ │
│ │ │ │ │ │
│ │ │ 初始化Bean │ │
│ │<─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ │ │ │ │ │
│ │ │ │ │调用BeanPostProcessor (初始化后) │
│ │ │ │ │<────────────────────────────────│
│ │ │ │ │ │
│返回应用上下文(Bean已初始化) │ │ │ │ │
│<──────────────────────────────│ │ │ │ │
│ │ │ │ │ │
│ │ │ 使用Bean │ │ │
│─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────>│
│ │ │ │ │ │
│ │ │ │ │ │
│ │ │ ╔══════╗ │ │ │
══════════╪═══════════════════════════════╪══════════════════════════════╪═════════╣ 销毁阶╠段 ═══════╪═════════════════════════════════╪═════════════════════════════════╪════════
│ │ │ ╚══════╝ │ │ │
│ │ │ │ │ │
│ 请求销毁 │ │ │ │ │
│──────────────────────────────>│ │ │ │ │
│ │ │ │ │ │
│ │ 销毁Bean │ │ │
│ │─────────────────────────────────────────────────────────>│ │ │
│ │ │ │ │ │
│ │ │ │ 调用Bean销毁方法 │
│ │ │ │──────────────────────────────────────────────────────────────────>│
│ │ │ │ │ │
│ │ │ 完成销毁 │ │
│ │<─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ │ │ │ │ │
│ 应用已销毁 │ │ │ │ │
│<──────────────────────────────│ │ │ │ │
应用程序 ┌────────┴───────┐ ┌──────────┴─────────┐ ┌─────┴─────┐ ┌────────┴────────┐ ┌──┴─┐
┌─┐ │Spring Container│ │BeanDefinitionReader│ │BeanFactory│ │BeanPostProcessor│ │Bean│
║"│ └────────────────┘ └────────────────────┘ └───────────┘ └─────────────────┘ └────┘
└┬┘
┌┼┐

┌┴┐

mermaid test
https://withesse.co/post/mermaidtest/
Author
zt
Posted on
May 23, 2024
Licensed under