-
Notifications
You must be signed in to change notification settings - Fork 19
/
main.go
36 lines (29 loc) · 952 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
35
36
package main
import (
"github.com/stackus/ftgogo/consumer/internal/adapters"
"github.com/stackus/ftgogo/consumer/internal/application"
"github.com/stackus/ftgogo/consumer/internal/domain"
"github.com/stackus/ftgogo/consumer/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
consumerRepo := adapters.NewConsumerRepositoryPublisherMiddleware(
adapters.NewConsumerAggregateRepository(svc.AggregateStore),
adapters.NewConsumerEntityEventPublisher(svc.Publisher),
)
app := application.NewServiceApplication(consumerRepo)
// Drivers
handlers.NewCommandHandlers(app).Mount(svc.Subscriber, svc.Publisher)
handlers.NewRpcHandlers(app).Mount(svc.RpcServer)
return nil
}