forked from GoogleCloudPlatform/functions-framework-python
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathhttp-binding.puml
More file actions
73 lines (52 loc) · 1.83 KB
/
http-binding.puml
File metadata and controls
73 lines (52 loc) · 1.83 KB
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
64
65
66
67
68
69
70
71
72
73
@startuml HTTP Binding
box Function Process in Local Environment or Container
control ENTRYPOINT
participant "~__main__" as Main
participant HTTPServer
participant Server [
Web Server
----
""Flask/Gunicorn""
]
participant Middleware
participant "User Function" as UserFunction
participant DaprClient
end box
entity "Dapr Sidecar " as DaprSidecar
== OpenFunction Serving ==
ENTRYPOINT -> Main ** : execute
note over ENTRYPOINT, Main: Pass through __CLI arguments__ and \ncontainer __environment variables__
Main -> Main : load user fnction file
note left: ""function (request) {}""
Main -> HTTPServer ** : create
note over Main, HTTPServer: Hand over __user function__, __function type__ \nand __context__ parsed from env variables
HTTPServer -> Server ** : new
note over Server: Depend on debug mode
HTTPServer -> Middleware ** : new
HTTPServer -> Server : use Middleware
note over HTTPServer, Server: Pass context to middleware
|||
HTTPServer -> Server : use others middlewares
|||
HTTPServer -> UserFunction ** : wrap user function
note over HTTPServer, UserFunction: Register as HTTP or CloudEvent Function
HTTPServer -> Server : bind wrapper to "/*" route
...
== OpenFunction Invocation ==
[-> Server ++ : HTTP request to "/"
Server -> UserFunction ++ : execute user function
UserFunction --> Server -- : return execution result "data"
alt ""runtime"" = ""knative"" and ""outputs"" is not empty
Server -> Middleware ++ : invoke Middleware
Middleware -> DaprClient ** : new
loop each OpenFunction Output
Middleware -> DaprClient ++ : send "data"
DaprClient -> DaprSidecar ++ : invoke binding or publication with "data"
DaprSidecar --> DaprClient -- : return result
DaprClient --> Middleware -- : forward result
end
Middleware --> Server -- : return "data" as response
end
[<- Server -- : send response
...
@enduml