I am trying run a thread in a function.This function gets the data coming from the socket and assing this data into thinking property.But I get 'Not authorized for Property Write in thingworx'.I looked at the thingworx extension API Doc. But I did not find any examples about this ThreadLocalContext.Where do I make mistakes
public void startThread() {
Thread t = new Thread(() -> {
String line = "";
try {
SecurityContext systemContext = SecurityContext.createSystemUserContext();
ThreadLocalContext.setSecurityContext(systemContext);
Thing thing = ThingUtilities.findThing("AEOSEvents");
ThreadLocalContext.clearSecurityContext();
while ((line = reader.readLine()) != null) {
thing.setPropertyValue("rawEvents", new StringPrimitive(line));
}
}
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
});
t.start();
}
Have you checked that the permissions for the AEOSEvents Thing allow the system user to write to this rawEvents property?
Yes. I have checked.Not only about permission.But i did it.I have to use TransactionFactory for multithread in thingworx.
