Pub/Sub messages schema

This guide shows some examples of output messages that Manufacturing Data Engine (MDE) publishes over Pub/Sub.

Protobuf Pub/Sub sink

The output messages that MDE publish over Pub/Sub have the following schema in Protobuf format.

syntax = "proto3";

package google.cloud.mde.sink;

option java_package = "com.google.cloud.industry.manufacturing.mde.sink.pubsub";
option java_multiple_files = true;

message MDETagStreamingObject {
  string id = 1;
  string tag_name = 2;
  int32 type_version = 3;
  string embedded_metadata = 4;
  string materialized_cloud_metadata = 5;
  string cloud_metadata_ref = 6;
  int64 ingest_timestamp = 7;
  string source_message_id = 8;
  TagStreamingTimestampObject timestamps = 9;
  TagStreamingDataObject data = 10;
  TagStreamingFormat format = 11;

  message TagStreamingDataObject {
    oneof data_values {
      double numeric = 1;
      string complex = 2;
    }
  }

  message TagStreamingTimestampObject {
    oneof timestamps {
      int64 event_timestamp = 1;
      TagStreamingContinuousTimestampObject continuous_timestamp = 2;
    }
  }

  message TagStreamingContinuousTimestampObject {
    int64 event_timestamp_start = 1;
    int64 event_timestamp_end = 2;
  }

  enum TagStreamingFormat {
    PROTO = 0;
    JSON  = 1;
  }
}

JSON Pub/Sub sink

The output messages that MDE publish over Pub/Sub have the following schema in JSON format.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "JSON Pub/Sub sink",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "tagName": {
      "type": "string"
    },
    "typeVersion": {
      "type": "number"
    },
    "embeddedMetadata": {
      "type": "object"
    },
    "materialized_cloud_metadata": {
      "type": "object",
      "description": "Keys are cloud metadata bucket bucket names",
      "additionalProperties": {
        "type": "object",
        "description": "Cloud metadata instance"
      }
    },
    "cloud_metadata_ref": {
      "type": "object",
      "description": "Keys are cloud metadata bucket bucket names",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "instance_id": {
            "type": "string",
            "description": "Cloud metadata instance id",
            "format": "uuid"
          }
        }
      }
    },
    "ingestTimestamp": {
      "type": "number",
      "description": "Timestamp when message was published to the Pub/Sub sink topic",
      "format": "unix-epoch-millis"
    },
    "source_message_id": {
      "type": "string",
      "description": "Pub/Sub source message id",
      "format": "uuid"
    },
    "timestamps": {
      "type": "object",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "eventTimestamp": {
              "type": "number",
              "description": "Event timestamp",
              "format": "unix-epoch-millis"
            }
          },
          "required": ["eventTimestamp"]
        },
        {
          "type": "object",
          "properties": {
            "eventTimestampStart": {
              "type": "number",
              "description": "Event timestamp",
              "format": "unix-epoch-millis"
            },
            "eventTimestampEnd": {
              "type": "number",
              "description": "Event timestamp",
              "format": "unix-epoch-millis"
            }
          },
          "required": ["eventTimestampStart", "eventTimestampEnd"]
        }
      ]
    },
    "data": {
      "type": "object",
      "additionalProperties": true
    },
    "format": {
      "type": "number",
      "enum": [0, 1]
    }
  },
  "required": [
    "id",
    "tagName",
    "typeVersion",
    "ingestTimestamp",
    "source_message_id",
    "timestamps",
    "data",
    "format"
  ]
}