May 16, 2024 - New EPL actions for creating and parsing the c8y_Position fragment

Change Header


Change Type: Improvement
Product area: Analytics
Component: Streaming Analytics
Deployed at: eu.latest.cumulocity.com, apj.cumulocity.com, jp.cumulocity.com, cumulocity.com, us.cumulocity.com, emea.cumulocity.com

Technical details

Build artifact: apama-in-c8y (25.129.0)
Internal ID: PAM-34615

Change Description


The ManagedObject event has a unique way of handling c8y_Position fragments that have the parseable float values added to their position property, and all other values added to their params property. All other events of the Cumulocity transport API simply add the fragment as a whole to their params property. This has made it cumbersome to robustly copy c8y_Position to a ManagedObject from another event and vice versa. To make this easier, two new helper actions have been added to the ManagedObject event to populate ManagedObject from a c8y_Position object, and conversely create the object from the ManagedObject event.

  • action setC8yPosition(any c8y_Position)

    This new action sets the ManagedObject using the c8y_Position object. This must be of the form dictionary<string, any>, but is validated prior to use. Example:

    on all Event(type="locationUpdate") as evt
    
    { ManagedObject mo := new ManagedObject;
      mo.id := evt.source;
      mo.setC8yPosition(evt.params.getOrDefault("c8y_Position"));
      send mo to ManagedObject.SEND_CHANNEL; }
    
  • action getC8yPosition() returns dictionary<string, any>

    This new action produces a c8y_Position style object from the ManagedObject. Example:

    evt.params["c8y_Position"] := mo.getC8yPosition();