Skip to main content
1-Visitor
March 17, 2020
Question

Best practices for Thingworx and MQTT

  • March 17, 2020
  • 3 replies
  • 10368 views

Hello everybody,

I have an application to monitoring a list of rooms with some attribute as temperature, humidity, power consumption, etc. and I will use MQTT to send the data to Thingworx Foundation. Actually, I have 2 solutions to do:

 - Solution 1: Using MQTT extension in market place. The workflow is as following: Sensor -> Gateway (Publish) -> MQTT Broker -> MQTT Extension (Subscriber). Then, by decoding the data in json (I plan to have only one MQTT client instance and subscriber all topic, then, a message includes thing name, attribute and values in pair), I will set directly the thing attribute. e.g. Things[A].attribute = MQTTThing.message.attribute_value. I am facing with problem in link , so, I assume that I can do it without any problem.

 - Solution 2: Using Thingworx Industrial Connectivity / Kepware ThingWorx. Sensor -> Gateway (Publish) -> MQTT Broker -> Kepware -> Thingworx. The Kepware will use as MQTT client and send data to Thingworx using "Always On" connection.

Hence, which solution is the best practices for using MQTT with Thingworx ??

With the scale of system, a technique support of PTC recommends me to use the solution 2. As he said, because the MQTT Extension receives data from broker and after that, MQTT Extension shall update the Thing attribute by using REST API. So, it causes high load in the server because of http request header. But I didn't find any documents mentioned about this information. I hope someone know about the Thingworx structure can confirm this information is right or wrong.

And with the solution 2, are there any tools to scale the problem ? Because as my experiment with Kepware and PLC, I need to map each tag in PLC to Thing attribute. If I scale my problem to 1000 rooms, it is a nightmare if I do it manually..

3 replies

18-Opal
March 17, 2020

Hello @trungkien2104,

 

Just my 2 cents:

  1. You shouldn't use MQTT (and similar) extensions for any sizeable load simply because they run in ThingWorx JVM and compete with the platform for computational resources.
  2. This extension does not use HTTP to set property values.

Unfortunately I don't know Kepware enough to comment on the recommended best practices.

 

Regards,
Constantine

1-Visitor
March 17, 2020

Thank for your response. I also think the extension does not use HTTP request. But you have some document mentioned about it. I tried to use tcpdump in Thingworx Foundation port and didn't receive any HTTP request to modify attribute from extension.

16-Pearl
March 17, 2020

Hi,

 

I'm not sure how REST comes into play in the MQTT extension (the extension is running in the platform JVM).

 

In addition to the MQTT extension  and KEPServer intergration, you may want to consider the ThingWorx Protocol Adapter Toolkit - it has an out of the box MQTT channel and it is very convenient for data ingestion if your message payload includes thing name, attribute and values in pair.

1-Visitor
March 17, 2020

Thank for your suggestion. I'm not familiar with Java ( I'm Python Developer), so, I prefer using the available solution than develop a new one using SDK.

Support
March 26, 2020

Hi @trungkien2104.

 

For something of this nature, we recommend reaching out to Sales for engaging with one of Global Services consultants.  They can assess your needs and develop a scalable solution.

 

Regards.

 

--Sharon

Support
April 13, 2020

Hi @trungkien2104.

 

Please let us know if you have found a solution to your issue.  If so, please post it here and mark it as the Accepted Solution for the benefit of others on the community.

 

Regards.

 

--Sharon

 

 

1-Visitor
April 15, 2020

Hi Sharon,

I am waiting someone who already tested between MQTT extension and Kepware to see which one has higher performance.