# Model.Delete

Deletes an object model (aka requested model) in IM.

The model.delete action message is sent to the platform by a directly connected device (i.e. Edge) via the IoTHub.

The requested model must exist in the information model service.

# Idempotency

The model.delete message is Idempotent. This means that sending several identical requests will result in the model being deleted successfully in the Info Model Service:

  • The first delete of an existing object model (determined via objectId + model) will be successful.

  • Subsequent deletes of this object model will be rejected.

# Event Properties

# Unique Message Headers

Property Mandatory Description
objectId Mandatory Object identifier. Must be in GUID format.
model Optional Model definition identifier (modelId). Any model, including abb.ability.device, is supported. If not provided, defaults to abb.ability.device.

# Message Format

A model.delete action message has the following format when it is received and ready for processing. Only data relevant for the DCS is shown.

{
  "properties": {
    "iothub-connection-device-id": "<authenticated device id>",
    "msgType": "action",
    "action": "model.delete",
    "version": 2,
    "correlationId": "<correlation id>",
    "objectId": "<GUID>",
    "model": "<model definition>",
    "ack": "<ack>",
    "target": "<connected device path>",
    "timeout": "<integer>"
  },
  "body": "none"
}

# Validation Rules

DCS validates all message properties as in the summary page of all v2 Device API messages. DCS does not validate message body because it is empty.

# Functionality

When this event is successfully ingested the object model is deleted in the information model service, including children with the isContainment flag.

Note that a 'request-response' model notification C2D message Abb.Ability.ObjectModel.Deleted will not be sent back to the directly connected device.

If requested, an acknowledgement C2D message will be sent, which can be propagated further as needed based on the target property.

Any platform events generated by the information model service related to this request are ignored by the DCS and are not propagated.

# Format of a Returned Acknowledgment C2D Message

# Format of a Successful Acknowledgment

{
  "properties": {
    "msgType": "ack",
    "action": "model.delete",
    "version": 2,
    "correlationId": "<correlation id>",
    "target": "<target matches the target in the corresponding action>",
    "timestamp": "<YYYY-MM-DDTHH:mm:ss.sssZ>"
  },
  "body": {
    "success": true,
    "code": "ok",
    "details": "",
    "objectId": "<objectId>",
    "model": "<model>"
  }
}

# Format of a Failing Acknowledgment

{
  "properties": {
    "msgType": "ack",
    "action": "model.delete",
    "version": 2,
    "correlationId": "<correlation id>",
    "target": "<target matches the target in the corresponding action>",
    "timestamp": "<YYYY-MM-DDTHH:mm:ss.sssZ>"
  },
  "body": {
    "success": false,
    "code": "<error code>",
    "details": "<error details>"
  }
}

# request-response Notification Conditions

The Device API does not send a C2D ObjectModel.Deleted notification message for a requested model. In the absence of a notification, the user has the following options:

Use a Device.Deleted message to receive a request-response' notification. State persistence will be maintained on the Edge MQTT topic.

Use a model.delete message when a 'request-response' notification is not needed. State persistence will not be maintained on the Edge MQTT topic if:

  • state persistence is not used.

  • state persistence is used on the Edge MQTT topic; in this case, the user must clean up this topic after successful model deletion.

  • state persistence is used via volumes; in this case, the user must clean up the volume after successful model deletion.

See also Functionality, above.

NOTE

The Edge can still use the Device API v1 Device.Deleted message, with or without an acknowledgment request.

# Error Handling

When an error occurs the following processes occur to log relevant information:

  • The model.delete message is completed inside the platform on the Azure ServiceBus.

  • Error information is logged inside the Platform in Application Insights.

  • If a response can be delivered back to the device acknowledgments are sent back to the device, if requested.

  • If a response cannot be sent back to the device, the message is completed and only the error is logged.

Last updated: 9/6/2021, 1:25:50 PM
Feedback