diff --git a/main.go b/main.go index 9f97067..e6f0baa 100644 --- a/main.go +++ b/main.go @@ -21,9 +21,9 @@ var ( tearDownInProgress = false randomSource = rand.New(rand.NewSource(time.Now().UnixNano())) - subscriberClientIdTemplate = "test-client-s-%d-%d" - publisherClientIdTemplate = "test-client-p-%d-%d" - topicNameTemplate = "internal/monitoring/endToEndXx-%d-%d" + subscriberClientIdTemplate = "mqtt-stresser-sub-%s-worker%d-%d" + publisherClientIdTemplate = "mqtt-stresser-pub-%s-worker%d-%d" + topicNameTemplate = "internal/mqtt-stresser/%s/worker%d-%d" opTimeout = 5 * time.Second diff --git a/worker.go b/worker.go index 011aa96..71356ce 100644 --- a/worker.go +++ b/worker.go @@ -14,9 +14,14 @@ func (w *Worker) Run() { cid := w.WorkerId t := randomSource.Int31() - topicName := fmt.Sprintf(topicNameTemplate, w.WorkerId, t) - subscriberClientId := fmt.Sprintf(subscriberClientIdTemplate, w.WorkerId, t) - publisherClientId := fmt.Sprintf(publisherClientIdTemplate, w.WorkerId, t) + hostname, err := os.Hostname() + if err != nil { + panic(err) + } + + topicName := fmt.Sprintf(topicNameTemplate, hostname, w.WorkerId, t) + subscriberClientId := fmt.Sprintf(subscriberClientIdTemplate, hostname, w.WorkerId, t,) + publisherClientId := fmt.Sprintf(publisherClientIdTemplate, hostname, w.WorkerId, t) verboseLogger.Printf("[%d] topic=%s subscriberClientId=%s publisherClientId=%s\n", cid, topicName, subscriberClientId, publisherClientId)