-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathwire_gen.go
100 lines (94 loc) · 4.88 KB
/
wire_gen.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Code generated by Wire. DO NOT EDIT.
//go:generate go run -mod=mod github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package main
import (
"github.com/newscred/webhook-broker/config"
"github.com/newscred/webhook-broker/controllers"
"github.com/newscred/webhook-broker/dispatcher"
"github.com/newscred/webhook-broker/storage"
)
// Injectors from wire.go:
// GetAppVersion retrieves the app version
func GetAppVersion() config.AppVersion {
appVersion := config.GetVersion()
return appVersion
}
// GetHTTPServer returns the server container with all adjacent data
func GetHTTPServer(cliConfig *config.CLIConfig) (*HTTPServiceContainer, error) {
configConfig, err := config.GetConfigurationFromCLIConfig(cliConfig)
if err != nil {
return nil, err
}
serverLifecycleListenerImpl := NewServerListener()
migrationConfig := GetMigrationConfig(cliConfig)
dataAccessor, err := storage.GetNewDataAccessor(configConfig, migrationConfig, configConfig)
if err != nil {
return nil, err
}
appRepository := newAppRepository(dataAccessor)
statusController := controllers.NewStatusController(appRepository)
producerRepository := newProducerRepository(dataAccessor)
producerController := controllers.NewProducerController(producerRepository)
producersController := controllers.NewProducersController(producerRepository, producerController)
channelRepository := newChannelRepository(dataAccessor)
consumerRepository := newConsumerRepository(dataAccessor)
messageRepository := newMessageRepository(dataAccessor)
deliveryJobRepository := newDeliveryJobRepository(dataAccessor)
messageController := controllers.NewMessageController(messageRepository, deliveryJobRepository)
jobRequeueController := controllers.NewJobRequeueController(deliveryJobRepository, channelRepository, consumerRepository)
dlqController := controllers.NewDLQController(messageController, jobRequeueController, deliveryJobRepository, consumerRepository)
consumerController := controllers.NewConsumerController(channelRepository, consumerRepository, dlqController)
consumersController := controllers.NewConsumersController(consumerController, consumerRepository)
messagesController := controllers.NewMessagesController(messageController, messageRepository)
lockRepository := newLockRepository(dataAccessor)
metricsContainer := dispatcher.NewMetricsContainer()
configuration := &dispatcher.Configuration{
DeliveryJobRepo: deliveryJobRepository,
ConsumerRepo: consumerRepository,
LockRepo: lockRepository,
BrokerConfig: configConfig,
ConsumerConnectionConfig: configConfig,
MsgRepo: messageRepository,
MetricsCollector: metricsContainer,
}
messageDispatcher := dispatcher.NewMessageDispatcher(configuration)
broadcastController := controllers.NewBroadcastController(channelRepository, messageRepository, producerRepository, messageDispatcher)
messagesStatusController := controllers.NewMessagesStatusController(messagesController, messageRepository)
channelController := controllers.NewChannelController(consumersController, messagesController, broadcastController, messagesStatusController, channelRepository)
jobsController := controllers.NewJobsController(channelRepository, consumerRepository, deliveryJobRepository)
jobController := controllers.NewJobController(messageController, channelController, producerController, consumerController, channelRepository, consumerRepository, deliveryJobRepository)
channelsController := controllers.NewChannelsController(channelRepository, channelController)
jobStatusController := controllers.NewJobStatusController(deliveryJobRepository)
handler := dispatcher.NewPrometheusHandler()
controllersControllers := &controllers.Controllers{
StatusController: statusController,
ProducersController: producersController,
ProducerController: producerController,
ChannelController: channelController,
ConsumerController: consumerController,
ConsumersController: consumersController,
JobsController: jobsController,
JobController: jobController,
BroadcastController: broadcastController,
MessageController: messageController,
MessagesController: messagesController,
DLQController: dlqController,
ChannelsController: channelsController,
MessagesStatusController: messagesStatusController,
JobRequeueController: jobRequeueController,
JobStatusController: jobStatusController,
MetricsHandler: handler,
}
router := controllers.NewRouter(controllersControllers)
server := controllers.ConfigureAPI(configConfig, serverLifecycleListenerImpl, router)
httpServiceContainer := &HTTPServiceContainer{
Configuration: configConfig,
Server: server,
DataAccessor: dataAccessor,
Listener: serverLifecycleListenerImpl,
Dispatcher: messageDispatcher,
}
return httpServiceContainer, nil
}