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

Stream do not store any data

SOLVED
Highlighted
Newbie

Stream do not store any data

Hello,

I'm currently trying to set up a stream to store data.

I created a service that store data into that stream and update the properties of the related thing.
When I execute that service, the properties of the thing are updated but nothing appears in the stream.

The service is not returning any error.

I even tried to push data in the stream directly from the default service "AddStreamEntry" on the stream itself.
And even if the service return no error, nothing is added in the stream.

I'm wondering if it's not somehow related to the persistent provider (we are using Postgresql, and on a previous installation with default db everything was working fine)

Any idea on what I am missing here?

Thanks in advance

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Stream do not store any data

Problem solved by downgrading the version of pgpool and postgresql...

Thanks for you help guys

View solution in original post

22 REPLIES 22

Re: Stream do not store any data

Are there any errors in the logs? Look under Monitoring > Application (top right corner of home-screen). Also check in the Script logs. Let me know!

Re: Stream do not store any data

Francesco, is it a Stream or a ValueStream? Are your properties logged? Is the user you are using an admin level user?

Re: Stream do not store any data

Hi, no there is nothing in the logs

Re: Stream do not store any data

it's a simple stream, the properties are indeed logged and the user is admin yes

Edit: I tested the valuesStream as well, and I can say that I have the exact same issue as with simple Streams (no data saved in the valuestream, nothing in the DB).

Re: Stream do not store any data

How are you writing to the stream? Value Streams work with the "Logged" option on properties. To update streams, there must be some service somewhere doing this in Javascript. Can you provide that?

Thanks!

Tori

Re: Stream do not store any data

Hello Tori,

My thing's properties have the options "logged" and "persistent" enabled

Here is the setup:

I have something like 10 things corresponding to LoRa devices.

I have a "callback interface" that is used by those LoRa devices to update their own properties.

On the callback interface I have a service "UpdateData" that will, thanks to a (unique) deviceID received as a parameter, update the properties of the related thing and store those new properties in a stream.

The devices call that "UpdateData" service every 15 minutes.

Here is the script of the service :

// define the log prefix

var logPrefix = me.name +"::LoRa.CallbackDataSet: ";

//##################-- calling OpenWeather webservice --##################

var OWparams = {

    url: "http://api.openweathermap.org/data/2.5/weather?lat="+Latitude+"&lon="+Longitude+"&units=metric&appid=**************************************" /* STRING */

};

// result: JSON

var OWresult = Resources["ContentLoaderFunctions"].GetJSON(OWparams);

if (OWresult != undefined)

    var externalTemp = OWresult.main.temp;

else {

    var externalTemp = 0;

    logger.error(logPrefix + " Failed to retrieve the external temperature from OpenWeather.");

}

//---------------- end of calling of OpenWeather webservice ----------------

//#############-- try to find a thing that has the given deviceid --#############

var thingName = me.getLoRaDeviceFromDeviceID({deviceId: DeviceID});

if(thingName == "") {

    logger.error(logPrefix + " Failed to find  thing provisioned for sigfoxId: " + DeviceID);

    throw "Failed to find thing provisioned for sigfoxId: " + DeviceID;

}

//-------------------------------------------------------------------------------

var dateNow = new Date();

//####################-- Setting params --####################

// location:LOCATION

var myLocation = new Object();

myLocation.latitude = Latitude;

myLocation.longitude = Longitude;

myLocation.elevation = Altitude;

myLocation.units ="WGS84";

Things[thingName].Temperature = Temperature;

Things[thingName].ExtTemperature = externalTemp;

Things[thingName].BatteryLifetime = BatteryLevel;

Things[thingName].FridgeHumidity = Humidity;

Things[thingName].FridgeLocation = myLocation;

Things[thingName].RSSI = RSSI;

Things[thingName].SNR = SNR;

Things[thingName].SpreadFactor = SpreadFactor;

Things[thingName].LastCommunication = dateNow;

//-----------------------------------------------------------

//####################-- Saving fridge value into stream --####################

var values = Things["SmartFridgeDataStream"].CreateValues();

values.RSSI = RSSI; //NUMBER

values.Temperature = Temperature; //NUMBER

values.ExtTemperature = externalTemp; //NUMBER

values.SNR = SNR; //NUMBER

values.SpreadFactor = SpreadFactor; //NUMBER

values.FridgeHumidity = Humidity; //NUMBER

values.BatteryLifetime = BatteryLevel; //NUMBER

values.FridgeLocation = myLocation; //LOCATION

var params = {

    values: values /* INFOTABLE*/,

    location: myLocation /* LOCATION */,

    source: thingName /* STRING */,

    timestamp: dateNow /* DATETIME */

};

// no return

Things["SmartFridgeDataStream"].AddStreamEntry(params);

//-----------------------------------------------------------

Normally I'm supposed to receive the parameters through HTTP POST request (that part is working fine I could test it by logging the received parameters.

But simply by clicking the "test" button of that update data service, I can clearly see that the script is successfully executed and that the properties of my things are updated. But nothing is added in the stream, and nothing appears in the logs.

Another important detail to know, We have another Thingworx platform setup (default installation with H2 default DB) and everything is working fine on that one !
It is on our new production setup, with PostgreSQL that it is not working (everything in HA).

Re: Stream do not store any data

Can you tell me more about these properties? Are they remotely bound? Are they located on a thingshape? What version of ThingWorx?

Re: Stream do not store any data

Well they are simple properties, only numbers and strings. and no there is no binding, I just assign the values though the services.
The properties are all defines on 2 different shapes, and there is one template implementing the 2 shapes. The the things implement the template.

But I just did a test and i'm now 99% sure that the issue is coming from the PostGreSQL setup (maybe HA is related?)

I just exported my whole project and imported it on a default thingworx installation (with H2 DB), and without any modifications the streams are working fine !
So it's definitely not a thing/service issue. I'm nearly sure it's coming from a communication issue between PostGreSQL and Thingworx, or something is not configured properly on that side...

Re: Stream do not store any data

Aanjan Ravi​ what do you make of this last comment?

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum! ______________________________