Minor chane, fixed integration scripts for many connections

This commit is contained in:
andsel
2015-12-06 19:04:26 +01:00
parent 9ce9a6597f
commit 585bf7523e
2 changed files with 3 additions and 2 deletions
@@ -31,7 +31,7 @@ class PublisherThread extends Thread {
mqtt.setCleanSession(true)
mqtt.setHost(host, 1883)
def postFix = oneClientPerTopic ? subId : ""
def postFix = oneClientPerTopic ? "" : pubId
mqtt.setClientId("PublisherClient${pubId}")
BlockingConnection connection = mqtt.blockingConnection()
@@ -31,7 +31,7 @@ class SubscriberThread extends Thread {
BlockingConnection connection = mqtt.blockingConnection()
connection.connect()
def postFix = oneClientPerTopic ? subId : ""
def postFix = oneClientPerTopic ? "" : subId
Topic[] topics = [new Topic("/topic${postFix}", QoS.AT_MOST_ONCE), new Topic("/exit${postFix}", QoS.AT_MOST_ONCE)]
byte[] qoses = connection.subscribe(topics)
boolean exit = false
@@ -53,6 +53,7 @@ if (args.size() < 1) {
int numSubscriber = args[0] as Integer
boolean singleTopic = (args.size() == 2 && args[1] == "single_topic")
println "Subscribing to ${numSubscriber} topic, with single ${singleTopic}"
(1..numSubscriber).each { numSub ->
def subTh = new SubscriberThread(numSub, singleTopic)
subTh.start()