Commit 243fd5ba authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Add error to handle method

parent ff5291c2
......@@ -103,8 +103,9 @@ func fetchInitialUpdates() (updates deploymentUpdates) {
return
}
func handleDeploymentUpdate(update deploymentUpdate) {
func handleDeploymentUpdate(update deploymentUpdate) error {
log.Printf(" [U] %s", update)
return nil
}
func handleInitialUpdates(initialUpdate deploymentUpdates) {
......@@ -171,7 +172,7 @@ func pubSub(services []service) {
msgs, err := ch.Consume(
q.Name, // queue
"", // consumer
true, // auto-ack
false, // auto-ack
false, // exclusive
false, // no-local
false, // no-wait
......@@ -183,7 +184,14 @@ func pubSub(services []service) {
go func() {
for d := range msgs {
handleDeploymentUpdate(readDeploymentUpdate(d.Body))
var err error
err = handleDeploymentUpdate(readDeploymentUpdate(d.Body))
failOnError(err, "Failed to handle message")
err = ch.Ack(
d.DeliveryTag,
false, // ack multiple (since delivery tag)
)
failOnError(err, "Failed to acknowledge message")
}
}()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment