-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathevents.go
58 lines (47 loc) · 1.9 KB
/
events.go
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
package core
import (
"net"
"net/http"
"google.golang.org/grpc"
)
type event string
const (
// OnHTTPServerStart is an event triggered when the http server is ready to serve
// traffic. At this point the module is already wired up. This event is useful to
// register service to service discovery.
OnHTTPServerStart event = "onHTTPServerStart"
// OnHTTPServerShutdown is an event triggered when the http server is shutting down.
// traffic. At this point The traffic can no longer reach the server, but the
// database and other infrastructures are not closed yet. This event is useful
// to unregister service to service discovery.
OnHTTPServerShutdown event = "onHTTPServerShutdown"
// OnGRPCServerStart is an event triggered when the grpc server is ready to serve
// traffic. At this point the module is already wired up. This event is useful to
// register service to service discovery.
OnGRPCServerStart event = "onGRPCServerStart"
// OnGRPCServerShutdown is an event triggered when the http server is shutting down.
// traffic. At this point The traffic can no longer reach the server, but the
// database and other infrastructures are not closed yet. This event is useful
// to unregister service to service discovery.
OnGRPCServerShutdown event = "onGRPCServerShutdown"
)
// OnHTTPServerStartPayload is the payload of OnHTTPServerStart
type OnHTTPServerStartPayload struct {
HTTPServer *http.Server
Listener net.Listener
}
// OnHTTPServerShutdownPayload is the payload of OnHTTPServerShutdown
type OnHTTPServerShutdownPayload struct {
HTTPServer *http.Server
Listener net.Listener
}
// OnGRPCServerStartPayload is the payload of OnGRPCServerStart
type OnGRPCServerStartPayload struct {
GRPCServer *grpc.Server
Listener net.Listener
}
// OnGRPCServerShutdownPayload is the payload of OnGRPCServerShutdown
type OnGRPCServerShutdownPayload struct {
GRPCServer *grpc.Server
Listener net.Listener
}