Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
We are trying to debug an extension (MQTT extension, to be exact) and we are wondering if and when is startThing() called when ThingWorx starts up? From our experience it seems that is not called when the server initializes.
Are you subscribing to the ThingStart event? If so, you can add a logging statement in there which will tell you exactly when the startThing() service is being called. I believe it should be called on server initialization, but I am not positive.
Mosquitto server works well.Subscrib ThingStart event,and log follows:
2017-04-07 11:33:49.716+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] *** Created thing instance in Thing: [educationConnectionThing3] ***
2017-04-07 11:33:49.716+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] Processing Things educationConnectionThing3
2017-04-07 11:33:49.717+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] There are 1 differences between the existing version of Thing educationConnectionThing3 and the version being imported.
2017-04-07 11:33:51.699+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] Updating Thing [educationConnectionThing3]
2017-04-07 11:33:51.977+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] Successfully persisted relationships for updated Thing [educationConnectionThing3]
2017-04-07 11:33:51.993+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] Successfully validated Thing [educationConnectionThing3]
2017-04-07 11:33:52.076+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] *** Initializing Things educationConnectionThing3
2017-04-07 11:33:52.422+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] *** Validating Subscriptions For Thing educationConnectionThing3
2017-04-07 11:33:52.449+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] *** Initializing Things educationConnectionThing3
2017-04-07 11:33:52.879+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] *** Starting Things educationConnectionThing3
2017-04-07 11:33:54.855+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] *** Activating property bindings for Things educationConnectionThing3
2017-04-07 11:33:55.325+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] *** Activating subscriptions for Things educationConnectionThing3
2017-04-07 11:33:55.424+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] *** initializing property binding relationships for Things : [educationConnectionThing3] ***
2017-04-07 11:33:55.425+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] *** initializing subscription relationships for Things : [educationConnectionThing3] ***
2017-04-07 11:33:55.425+0800 [L: INFO] [O: c.t.c.ImportProcessor] [I: ] [U: Administrator] [S: ] [T: http-nio2-8080-exec-9] *** Post start notifications for Things educationConnectionThing3
2017-04-07 11:38:45.656+0800 [L: ERROR] [O: c.t.t.m.MQTTConnectionThing] [I: ] [U: SuperUser] [S: ] [T: ForkJoinPool-1-worker-1] Unable to connect to MQTT in [educationConnectionThing3] : null
Is there other method to debug this problem?