ThingWorx Remote Access > Remote Access Subsystem
Remote Access Subsystem
The Remote Access Extension adds the RemoteAccessSubsystem to the ThingWorx Platform. This subsystem is generic and is shared by all RemoteAccessProvider Things, which include Axeda Global Access Servers v.6.9.2/v.6.9.3, ThingWorx Global Access Servers v.7.x, and the ThingWorx Internal Remote Access Provider for AlwaysOn devices.
The Remote Access Subsystem is used to persist and update remote sessions. It also generates audit messages for remote sessions. These audit messages are collected by the ThingWorx Audit Subsystem. The Remote Session history is maintained by storing historical Remote Session entries into persistence once they are completed.
To ensure remote sessions do not execute forever, a Maximum Session Duration (in hours) setting for the Remote Access Subsystem is enforced. To ensure remote sessions are properly cleaned up, the Inactive Session Timeout (in minutes) is also enforced. Both settings are configurable. Refer to the section below on configuring the subsystem for details.
Two events result in audit messages, a remote session is created and a remote session is completed. The Remote Access Extension fires these events (SessionCreated and SessionCompleted) to the RemoteAccessible Thing associated with the session when a session is started or completed. The triggering of either of these events results in an audit entry being logged that contains session information.
Configuring the Remote Access Subsystem
The subsystem has the following configuration settings:
Maximum Number of Sessions to Return from Data Storage specifies the maximum number of persisted remote sessions to return when there is a request for remote sessions. The default value is 500 sessions.
Timeout to indicate that the RemoteAccessClient is not installed locally specifies the number of milliseconds to wait before generating a message that says the ThingWorx Remote Access Client (RAC) is not installed on the user's computer.
Maximum Session Duration (in hours) specifies the maximum number of hours that a remote session can remain active. The default value is 24 hours, with a minimum value of 1 hour and a maximum value of 240 hours.
Inactive Session Timeout (in minutes) specifies the number of minutes that a remote session is allowed to remain inactive before it is timed out. The default value is 15 minutes, with a minimum value of 1 minute and a maximum value of 60 minutes.
The Remote Access Subsystem will throw exceptions if attempts are made to set values outside of the minimum and maximum values. Values for the subsystem can be set through ThingWorx Composer, as shown below:
The subsystem is started automatically when the ThingWorx Platform is started.
* 
Modifying the configuration of the inactivity timeout and the maximum session duration does not require a restart of the Remote Access Subsystem.
The Remote Access Subsystem will throw exceptions if callers attempt to set values outside of the minimum and maximum value ranges from either ThingWorx Composer or the SetConfigurationTable service.
The subsystem provides the following services to clean up old sessions and end inactive sessions:
Service
Description
Responsibilities
CleanupOldSessions
Called every 30 minutes (1800000 ms) by default, this sevice cleans up any sessions that have exceeded the maximum session duration by updating status to CLOSE_REQUESTED.
To change the default, refer to x
Determine expirationTime (in milliseconds) by subtracting: System.currentTimeMillis - HOURS.toMillis(maxSessionDuration).
Find all Remote Sessions with a createdTime field that is less than or equal to expirationTime.
For each session returned, set status to CLOSE_REQUESTED and then set the terminationCause to "Remote session close was requested due to max session duration of %s hours" and then update the session by calling updateRemoteSession(session).
TerminateInactiveSessions
Called every minute (60000 ms) by default, this service ends any inactive sessions and sets the status to TERMINATED. To change the default, refer to TerminateInactiveSessionsTimer Thing.
Determine inactiveTime (in milliseconds) by subtracting: System.currentTimeMillis - MINUTES.toMillis(maxSessionDuration).
Find all Remote Sessions with a lastActivityTime field less than or equal to inactiveTime.
For each session returned, set the status to CLOSE_REQUESTED if it is not already set to CLOSE_REQUESTED. If the status is already CLOSE_REQUESTED, set the status to TERMINATED and then set the terminationCause to "Remote session was terminated due to session inactive timeout of %s minutes". Then, update the session. The CleanupOldSessionsTime runs and sets the sessions that exceed max_session_duration to CLOSE_REQUESTED. The UpdateSession service automatically refreshes the lastActivityTime when it updates the session.
* 
Since the status is TERMINATED, the session is removed from persistence and also from the subsystem.
* 
The lastActivityTime property of a Thing is updated with each GAS status update and with status updates from the Remote Access Client (RAC). Any update from either GAS or RAC will result in the lastActivityTime property being updated and the session will not time out. "Inactivity" to the ThingWorx Platform means only that the platform has not received a status update from either RAC or GAS. Inactivity does not mean that there are no bytes being transferred.
Was this helpful?