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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Problem to insert data into Stream

dbologna
11-Garnet

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

2 REPLIES 2
PaiChung
22-Sapphire I
(To:dbologna)

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.

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

Top Tags