Skip to main content
Nov 12, 2019 7:52 AM UTC
Solved

Problem to insert data into Stream

Hi All,

I have problem to insert a data into Stream from subscription.

In the following my step :

1) I built a service to insert data into stream

//
var tags = new Array();
var values_xx = Things["ThingStreamForTest"].CreateValues();
values_xx.ALARM = InputAlarm; // STRING
values_xx.DataOra = InputDate; //DATETIME
// location:LOCATION
var location = new Object();
location.latitude = 0;
location.longitude = 0;
location.elevation = 0;
location.units ="WGS84";
//
var params_xx = {
tags : tags,
timestamp : InputDate,
source : me.name,
values : values_xx,
location : location
};
// AddStreamEntry(tags:TAGS, timestamp:DATETIME, source:STRING("me.name"), values:INFOTABLE(TestDataStream), location:LOCATION):NOTHING
Things["ThingStreamForTest"].AddStreamEntry(params_xx);

2) I run thin service with input parameter and the data are insert into Stream (it Work)

3) If I call the service from subscription I received the following message

Execution error in service script [ThingofProcedure GestionePacketFromMqttBrokerToStreamNew] : Wrapped java.lang.NullPointerException Cause: null

I tried these steps on Thinworx 8.4 (Linux) and Thingworx 8.0.1 (Windows) bu I received the same error

 

Can anyone help me

Dimitri

dbolognaAnswer
Nov 15, 2019 4:03 PM UTC

You  are correct, the problem was due to missing permission to the persistent provider used by the stream. We solver adding the permission to System that run subscription. 

Thank you very much

2 replies

Nov 12, 2019 3:32 PM UTC

My initial thought would be a permissions issue.

Make sure that the context in which the subscription runs has visibility to both the stream and the persistence provider.

dbolognaAuthorAnswer
Nov 15, 2019 4:03 PM UTC

You  are correct, the problem was due to missing permission to the persistent provider used by the stream. We solver adding the permission to System that run subscription. 

Thank you very much