Skip to content

Create IoT Event Definition#

🔒 IoTEventDefinition.Create

🔒 IoTEventDefinition.CreateTemplate

🔒 IoTEventDefinition.CreateFromTemplate

Overview#

This operation is used to create an IoT Event Definition.

Setup#

No specific setup is required other than to meet the preconditions of the transaction.

Preconditions#

  • The IoT Event Definition does not currently exist in the system.

Sequence of Steps#

Step 1: General Data#

  1. Provide a name for the IoT Event Definition.

    Warning

    This name will identify the Event throughout the Data Platform infrastructure. Please use a name that is meaningful for later reference.

  2. Optionally, provide a description of the IoT Event Definition.

  3. Select the IoT Event Definition type. The available values are described in the IoTEventDefinitionType Lookup Table. This value can later be used to group event types into categories.
  4. Type in the Time to Live (TTL) in days. This is an optional parameter that informs the number of days this event will be stored in the Data Platform. If left blank (default), the system will store this event indefinitely (recommended).
  5. Select the Scope:
    • Enterprise Integration - allowing the execution of workflows in response to events of this Scope that are posted by Integration Entries.
    • Data Platform - allowing usage within the context of Data Platform tasks and workflows.
    • Factory Automation - allowing the creation and execution of automation jobs to be managed in the Monitoring section of the Automation panel.
    • General - allowing usage within the realm of the Automation Controller and Connect IoT.
  6. Select the Folder where this information will be stored.
  7. Select the Owner Type. The available options are: App, Role, and User.
  8. According to the Owner Type selected you must now select either an App, a Role or a User.
  9. Select Next to choose the properties for the IoT Event Definition.

create_iot_event_definition_step_one

Step 2: Properties#

This step captures the actual structure of the IoT Event Definition. Here you will define the individual properties of the event.

  1. On the left side panel, add as many properties as desired (select in the dropdown located in the top right of the grid to add, and to remove). The button allows adding top-level properties or, in case the property data type is IoT Schema, sub-properties of the main property.
  2. For each property, specify:

    • Name - This name must match the Event JSON document. It will be used internally to identify each property.
    • Friendly Name - Alternative name to identify the property.
    • Description - Property description.
    • Array - Identifies this property as an array of objects.
    • Mandatory - Identifies if the property is mandatory. If set to true, this information will be used to validate all the arriving events.
    • Indexed - Defines whether the property can be searched and queried. Furthermore, this determines whether the property is stored in the Kafka event header and in the Event Attribute table of the SQL Server Storage Consumer (For more information, see SQL Sinker IoT Consumer Definition).

      Info

      Array and Indexed properties are mutually exclusive.

    • Data Type - The data type of the property (mandatory, as an enumeration), which maps to the following JSON types (shown in parentheses):

      • Boolean (integer)
      • Date (date)
      • DateTime (date-time)
      • Decimal (number)
      • EntityType (object) - Refers to an Entity Type object. In case of a versioned Entity Type, it refers to the Definition. The content of this property will be used by the enrichment process to map MES information to the original event's document.
      • File (string) - Stores the File Id.
      • Integer (integer)
      • IoT Schema (object)
      • Long (sting)
      • String (string)
      • Time (time)
      • URL (uri)
    • Default Value - Specifies the default value of the property. If not present in the received event, this value will be set by the event validation process.
    • Minimum - The minimum value for data types of type integer. The event will be rejected if this value is less than what is defined.
    • Minimum - The maximum value for data types of type integer. The event will be rejected if this value is exceeded.
    • Min Length - Used to check the minimum length of a property of type string.
    • Max Length - Used to check the maximum length of a property of type string.
    • Pattern - For scalar types of type string, the pattern, for example: ^[A-Za-z]*@gmail.com$. This must be a valid Java regular expression.
    • Max File Size - For scalar types of type File, the maximum accepted file size.
    • Max File Scale - Maximum file size scale if the Data Type is file (Kilobytes, Megabytes, Gigabytes).
    • File Content Type - Used to select the File type the system will read. The system is able to read the following types: JSON, STEP, octet-stream, XML, CSV, excel among others.
    • Shared - For IoT Schema data types. Setting an IoT Schema as shared, informs the system to create as IoT Schema object. This is useful to share JSON document definitions between Events (for example, Location definitions).

create_iot_event_definition_step_two

You can also add properties of an existing IoT Schema by selecting the Copy Schema Properties option in the dropdown. Choose the desired IoT Schema from the list, as shown below.

create_iot_consumer_copy_schema_properties

Alternatively, you can also import a JSON or CSV definition of the desired schema by selecting the Import JSON option in the same dropdown.

create_iot_consumer_import_schema

Warning

If a schema is imported, a sanity check is strongly recommended as some property types can be incorrectly inferred (for example, integer instead of decimal).

Info

Both JSON and IoT Schema are also available to elect in data type.

Select Create to complete the operation and the new IoT Event Definition will be created.

Info

For more information, see the Event Ingestion through IoT Data Platform tutorial.