Managing eMessage Assets Through ThingWorx > Setting the Ping Rate Using ThingWorx Composer
Setting the Ping Rate Using ThingWorx Composer
The Axeda agent periodically pings a server such as Axeda Platform or ThingWorx Platform to send in messages (e.g., data updates) and to collect any messages that have been queued for it. The interval between ping messages is known as the ping rate for the Agent. By default, Agents are configured to contact the server every 60 seconds. You can change the ping rate temporarily from the Properties page for the Thing that represents an asset in ThingWorx Composer. Note that the new ping rate stays in effect until the next Agent restart.
To change the ping rate, follow these steps:
1. Log in to ThingWorx Composer.
2. Navigate to the Thing that represents the eMessage agent asset whose ping rate you want to change:
a. Click to display the Browse menu.
b. Select MODELING > Things to display a list of Things.
c. Select your Thing from the list.
3. Select Properties and Alerts to display the Properties | Alerts page for the Thing.
4. Locate the pingRate property in the list. The pingRate value is shown in milliseconds (ms). For example, for the Agent to ping every 60 seconds (the default rate), the value shown in Composer is 60000 (ms).
5. To change the ping rate, go to the Value column and click .
6. Under Set value of property in the right pane, type a new value for the ping rate.
7. To save the value and return to the Properties page, click .
If an error message appears, keep in mind that it is expected for eMessage Agents and appears when a Thing is not connected. ThingWorx queues the update for the ping rate and sends it to the agent (via eMessage Connector) the next time that the agent contacts ThingWorx (through the Connector).
Once the ping rate is successfully updated at the asset, subsequent pings from the agent occur at the new interval. Remember that once the agent restarts, the ping rate returns to the original value (that is, the value configured in the agent project). When the agent connects after the restart, its first message will include the original ping rate. The property will be updated in Composer.
Validation of the New Ping Rate
The new ping rate entered must be an integer between 10000 milliseconds (10 seconds) and 2147483647 (the maximum allowable integer). This range is the default range for setting a ping rate. You can change the minimal, acceptable ping rate. Refer to the section below, Changing the Minimum, Acceptable Ping Rate.
If overridden, the lowest acceptable minimum value is 5000 ms. If a value is entered outside this range, a WritePropertyError event is published to the Connection Services Hub. The event contains the validation error message and the Thing Name of the related device. The following table provides an example of the error message generated within the WritePropertyError event for an attempt to update the ping rate to 4000 ms, which is lower than the minimum, acceptable rate of 10000 ms:
Event Parameter
Value
context
[]
ThingName
The name of the related Thing (device), as it exists in ThingWorx
id
[any GUID]
message
Ping Rate update failed. Value 4000 cannot be less than 10000
properties name:
null
properties time:
null
properties value:
null
properties quality:
null
eventName
WritePropertyError
eventTime
Fri Feb 23 2018 08:28:31 GMT-0500(EST)
source
ConnectionServicesHub — the Connector sends the event to the Connection Services Hub
sourceProperty:
empty
Messaging
Messages sent from ThingWorx to an eMessage Agent are translated by the eMessage Connector into SOAP messages. Similarly, the notification messages returned by the Agent are translated by the Connector into AlwaysOn messages that ThingWorx Platform understands. Here is an example of the egress message sent to the agent to change the ping rate to every 20 seconds:
<SOAP-ENV.Envelope>
<SOAP-ENV.Body>
<EEnterpriseProxy.Pu mn="Model1" sn="Serial6" ow="axeda">
<Ra>20000</Ra>
</EEnterpriseProxy.Pu>
</SOAP-ENV.Body>
</SOAP-ENV.Envelope>
The agent returns an eMessage notification that the ping rate has changed. Here is an example:
<eMessage id="6" rc="0" v="6.8.3" gwid="-1" ggwmn="Model1"
gwsn="serial6" gwow="drm-data_source" gwk-"xxx>
<De did="-1" mn="Model1" sn="serial6" ow-"drm-data_source" k="xxx"
<Pr r="20000"/>
<SOAPStatus cmdid="Thing4-WRITE-Properties-pingRate#3#3" sc="0"
xsc="" t="2016-09-20T13:29:08:534Z" userId="serial6 / Model1"/>
</De>
</eMessage>
The SOAPStatus indicates the success or failure of the set ping rate action. In the example above, the SOAPStatus is 0, so the action succeeded. If the value were non-zero, it would indicate that an error occurred. In this situation, an EdgeError event is posted to the Connection Services Hub. The following table provides an example of the information for the EdgeError event that would be received for a failed ping rate update request:
Event Parameter
Expected Value
event Name
EdgeError
eventTime
<current_timestamp> For example: Tue Oct 25 2016 16:01:29 GMT-0400 (EDT)
source
ConnectionServicesHub
sourceProperty
[empty]
eventData ThingName
MyAsset
eventData context
{"operationParams":"{\"pingRate\":10000}","operation":"WRITE Properties","timestamp":1474401674623,"statusCode":3}
eventData id
[any GUID]
eventData message
SOAPStatus error
Changing the Minimum, Acceptable Ping Rate
To change the minimum, acceptable ping rate, change the value of the minimum-ping-rate property in the emessage group in the configuration file of eMessage Connector. After you edit the file, you need to restart the eMessage Connector for the change to take effect.
The following example sets this rate to 6 seconds (6000 ms). The absolute lowest acceptable rate is 5 seconds (5000 ms), so this rate, although not recommended, is valid:
include "application"
cx-server{
. . .
emessage {
. . .
minimum-ping-rate = 6000
}
}
The following table lists examples of invalid entries for minimum-ping-rate, the reasons that they are invalid, and the behavior that you can expect. Note that “the console” is the shell (or Command Prompt) on the computer where the eMessage Connector is restarted:
Invalid Value
Reason
Action Taken
4000
It is lower than the absolute lowest value of 5000 ms
A WARNING message is logged to the console, and the default minimum ping rate is set to 5000 ms.
“6000”
With the double-quotation marks, this value is a string, which is an invalid type for this property.
The eMessage Connector fails to start, and an error message describing why is logged to the console.
2247483650
A value that is greater than the maximum value for an Integer (2147483647) is invalid.
The eMessage Connector fails to start, and an error message describing why is logged to the console
Was this helpful?