PublishObject() Action

Back to Actions Reference

The PublishObject() action publishes an XML-serialized representation of the associated object to the integration queue (ActiveMQ). The serialized object is the domain object for which the trigger is being executed. If you are not sure which actions are supported for which namespaces and triggers, refer to Using Appropriate Actions and Namespaces with Triggers for Expression Rules.

The trigger-to-object mapping follows:

Trigger

Object to publish

Alarm
AlarmExtendedDataChange AlarmStateChange
AlarmSeverityChange

 

The Alarm that was posted

 

Data
 

A DataItemMessage containing the data items that were posted
 

File
 

Metadata describing the file that was uploaded
 

MobileLocation
 

The location that was posted
 

Registration
 

Details of the registration message
 

UserLogin/UserLogout
 

The login name of the user who logged in or logged out of the Axeda® Connected Product Management Applications
 

For details on the integration queue and examples of what these published objects would look like, refer to the Axeda® Platform ActiveMQ Installation and Configuration Guide.

Formats:

PublishObject()

PublishObject(boolean includeDevice)

PublishObject(boolean includeDevice, String properties)

where:

includeDevice - optional flag that specifies whether the "Device" object should be included. The default value is "true." The trigger must be an asset-related trigger for you to be able to include the Device object. In the list of Triggers in the table above, the asset-related triggers are Data, Alarm, AlarmExtendedDataChange, AlarmStateChange, AlarmSeverityChange, MobileLocation, File, and Registration. The UserLogin and UserLogout triggers are system-related triggers; you cannot include the Device object when the expression rule trigger is one of these system-related triggers.

properties - optional; additional message properties to include in message metadata. The format for these properties is "key1=val1;key2=val2; ".

 

Examples:

The following example publishes the Data object (a data item) that generated the expression rule and the Device object associated with the data item.

Trigger: Data

Then/Else: PublishObject(true)

 

The following example publishes the User object associated with the trigger message, which includes the name of the user whose login triggered this expression rule.

Trigger: UserLogin
Then/Else: PublishObject()

 

The following example publishes the Alarm object (the Alarm that generated this expression rule), along with a user-supplied property "problemtype" and the severity as additional message properties. This message also includes the associated Device object. Note that you need to convert a number to a string using the str() function.

Trigger: Alarm
Then/Else: PublishObject(true, "problemtype=mechanical;severity=" + str(Alarm.severity))

An example of what the additional Device object would look like follows:

Device

<Device>

<context>

<context class="com.axeda.drm.user.SystemContextImpl">

<maxRows>0</maxRows>

<caseId>

<value>-1</value>

</caseId>

<userName>[System]</userName>

<dataSourceName>drm-data_source</dataSourceName>

</context>

</context>

<device>

<tenantId reference="../../context/context/caseId"/>

<tenant></tenant>

<id>

<value>482</value>

</id>

<context class="com.axeda.drm.user.SystemContextImpl" reference="../../context/context"/>

<serialNumber>m2m-sim3</serialNumber>

<name>m2m-sim3</name>

<pingRate>0</pingRate>

<missing>false</missing>

<offline>true</offline>

<gatewayDeviceOffline/>

<invalidToken>false</invalidToken>

<connector>M2M</connector>

<dateRegistered>2010-07-31 06:46:42.543 EDT</dateRegistered>

<customerId>

<value>2</value>

</customerId>

<locationId>

<value>2</value>

</locationId>

<modelId>

<value>141</value>

</modelId>

<conditionId>

<value>3</value>

</conditionId>

<deployedGateways/>

<savedGateways/>

<gatewayId reference="../../context/context/caseId"/>

<isBackupEnabled>false</isBackupEnabled>

<family>Axeda</family>

<networkAccessible>false</networkAccessible>

<protocolId>-1</protocolId>

<categoryCode>-1</categoryCode>

<retryCount>-1</retryCount>

<retryInterval>-1</retryInterval>

</device>

</Device>

 

 

See Also