Skip to main content
13-Aquamarine
November 12, 2019
Solved

Problem to insert data into Stream

  • November 12, 2019
  • 1 reply
  • 1366 views

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

Best answer by dbologna

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

1 reply

22-Sapphire I
November 12, 2019

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.

dbologna13-AquamarineAuthorAnswer
13-Aquamarine
November 15, 2019

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