forked from GoogleCloudPlatform/functions-framework-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathhttp-binding.puml
More file actions
76 lines (54 loc) · 1.9 KB
/
http-binding.puml
File metadata and controls
76 lines (54 loc) · 1.9 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
74
75
76
@startuml HTTP Binding
box Function Process in Local Environment or Container
control ENTRYPOINT
participant Main
participant Server
participant Express [
Web Server
----
""Express""
]
participant Interceptor
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 function file
note left: ""function (req, res) {}""
Main -> Server ** : create
note over Main, Server: Hand over __user function__, __function type__ \nand __context__ parsed from env variables
Server -> Express ** : new
Server -> Express : use init middleware
note over Server, Express: Store context in ""res.locals.context""
Server -> Interceptor ** : new
Server -> Express : use interceptor
|||
Server -> Express : use others middlewares
|||
Server -> UserFunction ** : wrap user function
note over Server, UserFunction: Use Node.js ""Domain"" to run function and catch exceptions
Server -> Express : bind wrapper to "/*" route
...
== OpenFunction Invocation ==
[-> Express ++ : HTTP request to "/"
Express -> UserFunction ++ : execute user function
UserFunction --> Express -- : return execution result "data"
alt ""runtime"" = ""knative"" and ""outputs"" is not empty
Express -> Interceptor ++ : invoke interceptor
Interceptor -> Interceptor : load context
Interceptor -> DaprClient ** : new
loop each OpenFunction Output
Interceptor -> DaprClient ++ : send "data"
DaprClient -> DaprSidecar ++ : invoke binding or publication with "data"
DaprSidecar --> DaprClient -- : return result
DaprClient --> Interceptor -- : forward result
end
Interceptor -> DaprClient !!
Interceptor --> Express -- : return "data" as response
end
[<- Express -- : send response
...
@enduml