cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Purging ValueStream entries from Deleted Things - Part 2 : InfluxDB

emoreira
Amethyst

Purging ValueStream entries from Deleted Things - Part 2 : InfluxDB

While I was writing my previous post about Purging ValueStream entries from Deleted Things , it occurred to me that a similar issue would happen to those using the InfluxDB as persistence provider for their ValueStreams.

 

I wanted to take the opportunity that the logic is still fresh in my mind and extend the utility to do the same thing with InfluxDB. I also used the opportunity to create a dynamic InfoTable as it's been a while since I did it. 

 

Also, it shows how to directly interact with the InfluxDB through its API. 

 

The modification is based on a new thing called influxDBConnector  which has the following services:

 

dropMeasurements: Deletes all the DB entries related to a Thing;

getAllEntries: Queries all entries related to a Thing. It has a string output;

getAllEntriesTable: Queries all entries related to a Thing. Infotable output;

getMissingThings: Queries ThingWorx Things tables and InfluxDB measurements. It filters to have in the result only the Measurements that are not in the Things table;

showMeasurements; Gets all the measurements in InfluxDB

 

Also the following properties:

database: Influx database name used to persist the value stream data;

InfluxLink: hostname:port to the InfluxDB server

 

Like the previous example, I created a sample mashup (purgeInfluxDBStreamsMashup ) to help to execute the services:

influxDBSampleMashup.jpg

 

Obviously this utility expects that there's an existing Influx persistence provider.

 

Once more: these services affect directly the DB and need to be used carefully and only by Administrators.  Make sure you fully test it before using it in production.

 

The attached XML contains the complete utility for PostgreSQL and InfluxDB.

 

Hope it helps

Ewerton

 

Tags (2)
Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.