-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathmain.go
38 lines (31 loc) · 1.06 KB
/
main.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
package main
import (
"github.com/stackus/ftgogo/kitchen/internal/adapters"
"github.com/stackus/ftgogo/kitchen/internal/application"
"github.com/stackus/ftgogo/kitchen/internal/domain"
"github.com/stackus/ftgogo/kitchen/internal/handlers"
"github.com/stackus/ftgogo/serviceapis"
"shared-go/applications"
)
func main() {
svc := applications.NewService(initService)
if err := svc.Execute(); err != nil {
panic(err)
}
}
func initService(svc *applications.Service) error {
serviceapis.RegisterTypes()
domain.RegisterTypes()
// Driven
ticketRepo := adapters.NewTicketRepositoryPublisherMiddleware(
adapters.NewTicketAggregateRepository(svc.AggregateStore),
adapters.NewTicketEntityEventPublisher(svc.Publisher),
)
restaurantRepo := adapters.NewRestaurantPostgresRepository(svc.PgConn)
app := application.NewServiceApplication(ticketRepo, restaurantRepo)
// Drivers
handlers.NewCommandHandlers(app).Mount(svc.Subscriber, svc.Publisher)
handlers.NewRestaurantEventHandlers(app).Mount(svc.Subscriber)
handlers.NewRpcHandlers(app).Mount(svc.RpcServer)
return nil
}