-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathmain.go
34 lines (27 loc) · 903 Bytes
/
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
package main
import (
"github.com/stackus/ftgogo/accounting/internal/adapters"
"github.com/stackus/ftgogo/accounting/internal/application"
"github.com/stackus/ftgogo/accounting/internal/domain"
"github.com/stackus/ftgogo/accounting/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
accountRepo := adapters.NewAccountAggregateRepository(svc.AggregateStore)
app := application.NewServiceApplication(accountRepo)
// Drivers
handlers.NewCommandHandlers(app).Mount(svc.Subscriber, svc.Publisher)
handlers.NewConsumerEventHandlers(app).Mount(svc.Subscriber)
handlers.NewRpcHandlers(app).Mount(svc.RpcServer)
return nil
}