Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
feat(server): add handler hostname
Browse files Browse the repository at this point in the history
- added handler hostname to identify the worker that processed the request.

#3
  • Loading branch information
Leo Breuer committed Jul 22, 2023
1 parent 9a8db17 commit 07746a4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"log"
"os"
"time"

amqp "github.com/rabbitmq/amqp091-go"
Expand Down Expand Up @@ -55,6 +56,8 @@ func Serve(queueName string, handler func(*gorm.DB, []byte) (handlers.Response,
jsonResponse, _ := json.Marshal(r)
headers := make(map[string]interface{})
headers["X-Process-Time"] = took
hostname, _ := os.Hostname()
headers["X-Worker"] = hostname
err := ch.PublishWithContext(ctx,
"",
d.ReplyTo,
Expand Down

0 comments on commit 07746a4

Please sign in to comment.