Skip to main content
6-Contributor
August 30, 2022
Question

How many mqtt things can we create in a TWX server?

  • August 30, 2022
  • 2 replies
  • 1237 views

Is there any limit that we can only create max 6000 mqtt things in a given TWX server? 

2 replies

14-Alexandrite
August 30, 2022

Hello,

 

please check  Composer > Browse > Subsystems > LicensingSubsystem > GetCurrentLicenseInfo > twx_things > AvailableFeatureCount

cf. https://www.ptc.com/en/support/article/CS316279

 

Best regards

Marc

Community Manager
September 9, 2022

Hi @SK_9989757.

 

Is there some reason you're asking?  This should only be a problem if your contract limits the number of assets.  Refer to the response from @M4RC for determining the number of things allowed.

 

Regards.

 

--Sharon 

1-Visitor
September 10, 2022

Hi @SK_9989757 

 

First, you can check your license limitation as mentioned in another comment. 

 

If it is more than 6000 you can check by yourself using the following script. If the output is the same as the thingcreated then it should work well to create 6000 MQTT things on ThingWorx. You need to set up your own MQTT broker first.

 
thingcreated = 6000;
result = 0;
for (i = 1; i < thingcreated + 1; i++) {
  thingName = "CreatedMQTT-" + i;
  let params = {
    name: thingName /* STRING */,
    description: undefined /* STRING */,
    thingTemplateName: "MQTT" /* THINGTEMPLATENAME */,
    projectName: "PTCDefaultProject" /* PROJECTNAME */,
    tags: undefined /* TAGS */,
  };
  // no return
  Resources["EntityServices"].CreateThing(params);
  let configTable = Things[thingName].GetConfigurationTable({
    tableName: "ConnectionInfo" /* STRING */,
  });
  configTable.rows[0].clientIdFormat = "/Thingworx/{s}/{t}";
  configTable.rows[0].useSSL = false;
  configTable.rows[0].serverName = "localhost";
  configTable.rows[0].serverPort = 1883;
  configTable.rows[0].userId = "testuser";
  configTable.rows[0].password = Resources["EncryptionServices"].EncryptPropertyValue({
    data: "testuser" /* STRING */,
  });
  Things[thingName].SetConfigurationTable({
    configurationTable: configTable /* INFOTABLE */,
    persistent: undefined /* BOOLEAN {"defaultValue":true} */,
    tableName: "ConnectionInfo" /* STRING */,
  });

  // let result = Things[thingName].GetConfigurationTable({
  //   tableName: "ConnectionInfo" /* STRING */,
  // });
  Things[thingName].EnableThing();
  Things[thingName].RestartThing();
  if (Things[thingName].isConnected) {
     result++;
   }
}
 
Best Regards