-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
29 lines (25 loc) · 1.01 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
package main
import (
"github.com/AITestingOrg/calculation-service/eureka"
"github.com/AITestingOrg/calculation-service/handlers"
"github.com/AITestingOrg/calculation-service/interfaces"
"github.com/AITestingOrg/calculation-service/utils"
)
func main() {
//make an AmqpPublisher to be injected into the following methods
amqpPublisher := new(utils.AmqpPublisher)
//make a list of api handlers that should all be added to a http controller
apiHandlers := []interfaces.ApiHandlerInterface{handlers.CostEstimateHandler{Publisher: amqpPublisher},
handlers.GetCostHandler{}}
//make a list of amqp consumers that should be consuming eventually
amqpConsumers := []interfaces.ConsumerInterface{
utils.AmqpConsumer{"trip.exchange.tripcalculation",
"topic",
"trip.queue.calculationservice.calculatecost",
"trip.estimation.estimatecalculated",
handlers.EstimateHandler{amqpPublisher},
}}
forever := make(chan bool)
go utils.ProgramSetup(amqpPublisher, apiHandlers, amqpConsumers, eureka.EurekaClient{})
<-forever
}