Minor chane, fixed integration scripts for many connections
This commit is contained in:
@@ -31,7 +31,7 @@ class PublisherThread extends Thread {
|
|||||||
mqtt.setCleanSession(true)
|
mqtt.setCleanSession(true)
|
||||||
mqtt.setHost(host, 1883)
|
mqtt.setHost(host, 1883)
|
||||||
|
|
||||||
def postFix = oneClientPerTopic ? subId : ""
|
def postFix = oneClientPerTopic ? "" : pubId
|
||||||
|
|
||||||
mqtt.setClientId("PublisherClient${pubId}")
|
mqtt.setClientId("PublisherClient${pubId}")
|
||||||
BlockingConnection connection = mqtt.blockingConnection()
|
BlockingConnection connection = mqtt.blockingConnection()
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class SubscriberThread extends Thread {
|
|||||||
BlockingConnection connection = mqtt.blockingConnection()
|
BlockingConnection connection = mqtt.blockingConnection()
|
||||||
connection.connect()
|
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)]
|
Topic[] topics = [new Topic("/topic${postFix}", QoS.AT_MOST_ONCE), new Topic("/exit${postFix}", QoS.AT_MOST_ONCE)]
|
||||||
byte[] qoses = connection.subscribe(topics)
|
byte[] qoses = connection.subscribe(topics)
|
||||||
boolean exit = false
|
boolean exit = false
|
||||||
@@ -53,6 +53,7 @@ if (args.size() < 1) {
|
|||||||
|
|
||||||
int numSubscriber = args[0] as Integer
|
int numSubscriber = args[0] as Integer
|
||||||
boolean singleTopic = (args.size() == 2 && args[1] == "single_topic")
|
boolean singleTopic = (args.size() == 2 && args[1] == "single_topic")
|
||||||
|
println "Subscribing to ${numSubscriber} topic, with single ${singleTopic}"
|
||||||
(1..numSubscriber).each { numSub ->
|
(1..numSubscriber).each { numSub ->
|
||||||
def subTh = new SubscriberThread(numSub, singleTopic)
|
def subTh = new SubscriberThread(numSub, singleTopic)
|
||||||
subTh.start()
|
subTh.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user