forked from lukasjarosch/genki
-
Notifications
You must be signed in to change notification settings - Fork 1
/
genki.go
31 lines (27 loc) · 1 KB
/
genki.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
package genki
import (
"github.com/marcoEgger/genki/broker"
"github.com/marcoEgger/genki/server"
"github.com/marcoEgger/genki/server/http"
"google.golang.org/grpc/health/grpc_health_v1"
)
// Application defines the application interface. It's designed to be simple and straightforward.
type Application interface {
// Name of the application
Name() string
// Run the application. This is a blocking call and will only return if the
// server is shut-down or an error occurred.
Run(healthServer grpc_health_v1.HealthServer) error
// Opts returns the current options
Opts() Options
// AddServer registers a new server with the application
AddServer(server server.Server)
// AddHttpServer registers a new http server with the application
AddHttpServer(srv http.Server)
// RegisterBroker registers a message broker implementation (AMQP, NATS, ...)
RegisterBroker(broker broker.Broker)
}
type Option func(options *Options)
func NewApplication(options ...Option) Application {
return newService(options...)
}