connect to amqp
This commit is contained in:
9
main.go
9
main.go
@@ -147,6 +147,7 @@ func main() {
|
||||
orderHandler := &RabbitTransportMaster{
|
||||
Url: amqpUrl,
|
||||
}
|
||||
|
||||
syncedServer := NewPoolServer(syncedPool, fmt.Sprintf("%s, %s", name, podIp))
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("/cart/", http.StripPrefix("/cart", syncedServer.Serve()))
|
||||
@@ -225,6 +226,14 @@ func main() {
|
||||
if err != nil {
|
||||
log.Printf("Error marshaling order: %v\n", err)
|
||||
} else {
|
||||
err = orderHandler.Connect()
|
||||
if err != nil {
|
||||
log.Printf("Error connecting to order handler: %v\n", err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
w.Write([]byte(err.Error()))
|
||||
return
|
||||
}
|
||||
defer orderHandler.Close()
|
||||
err = orderHandler.OrderCompleted(orderToSend)
|
||||
if err != nil {
|
||||
log.Printf("Error sending order: %v\n", err)
|
||||
|
||||
Reference in New Issue
Block a user