Azure / Industrial-IoT

Azure Industrial IoT Platform
MIT License
521 stars 215 forks source link

Orchestrated Publisher: Container create option "--mm=PubSub" not working. #1437

Closed mwiot closed 1 year ago

mwiot commented 2 years ago

Hi, I am having trouble getting the container create options to work properly for the publisher module when using the cloud orchestrated solution. Specifically I am trying to get the option "--mm=PubSub" to work, but I am not sure that any of the container create options are being used when using the orchestrated publisher.

Some additional info. Using:

Case 1: Use standalone publisher solution, nodes defined in pn.json

Publisher config:

{
  "Hostname": "publisher",
  "Cmd": [
    "publisher",
    "--pf=/appdata/pn.json",
    "--di=60",
    "--to",
    "--aa",
    "--si=10",
    "--ms=262144",
    "--mm=PubSub"
  ],
  "HostConfig": {
    "PortBindings": {
      "62222/tcp": [
        {
          "HostPort": "62222"
        }
      ]
    },
    "Binds": [
      "/var/iiotedge:/appdata"
    ],
    "ExtraHosts": [
      "localhost:127.0.0.1"
    ]
  }
}

IOT hub telemetry contains the correct message format specified in the container create options (pubsub):

[IoTHubMonitor] [1:42:57 PM] Message received from [vm-opc-simulator4/publisher]:
[
  {
    "MessageId": "101",
    "MessageType": "ua-data",
    "PublisherId": "opc.tcp://10.0.0.9:50000/_0f38f3b7bb07c7fd6505a9330091ce3660c8a868",
    "DataSetWriterGroup": "opc.tcp://10.0.0.9:50000/_0f38f3b7bb07c7fd6505a9330091ce3660c8a868",
    "Messages": [
      {
        "DataSetWriterId": "opc.tcp://10.0.0.9:50000/_f20e4a77ec212a940d80bb5773ff0ba92a22882a",
        "MetaDataVersion": {
          "MajorVersion": 1,
          "MinorVersion": 0
        },
        "Payload": {
          "nsu=http://microsoft.com/Opc/OpcPlc/;s=SlowUInt1": {
            "Value": 11142,
            "SourceTimestamp": "2021-10-21T13:42:54.4742935Z"
          },
          "nsu=http://microsoft.com/Opc/OpcPlc/;s=SlowUInt2": {
            "Value": 11142,
            "SourceTimestamp": "2021-10-21T13:42:54.4743084Z"
          }
        }
      }
    ]
  }
]

Case 2: Use orchestrated publisher , nodes defined in publisher cloud service.

Publisher config:

{
  "Hostname": "publisher",
  "Cmd": [
    "publisher",
    "--di=60",
    "--to",
    "--aa",
    "--si=10",
    "--ms=262144",
    "--mm=PubSub"
  ],
  "HostConfig": {
    "PortBindings": {
      "62222/tcp": [
        {
          "HostPort": "62222"
        }
      ]
    },
    "Binds": [
      "/var/iiotedge:/appdata"
    ],
    "ExtraHosts": [
      "localhost:127.0.0.1"
    ]
  }
}

IOT Hub telemetry does NOT contain the configured format, PubSub. This is the expected format when using --mm=Samples.

 {
    "NodeId": "http://microsoft.com/Opc/OpcPlc/#s=SlowUInt4",
    "EndpointUrl": "opc.tcp://10.0.0.8:50000/",
    "ApplicationUri": "urn:OpcPlc:aa01c4a97852",
    "DisplayName": "SlowUInt4",
    "Timestamp": "2021-10-21T13:46:30.4780657Z",
    "Status": "Good",
    "Value": {
      "Value": 9253,
      "SourceTimestamp": "2021-10-21T13:46:27.8657393Z",
      "ServerTimestamp": "2021-10-21T13:46:27.8657455Z"
    },
    "SequenceNumber": 1,
    "ExtensionFields": {
      "EndpointId": "uatf9afd7e8b1c510080c0da18e7e02a52c0b14247d",
      "PublisherId": "uatf9afd7e8b1c510080c0da18e7e02a52c0b14247d",
      "DataSetWriterId": "964e9cf9-9414-4610-9eff-a09dfdeaa337_5000"
    }
  }
mwiot commented 2 years ago

Hi again, any news on this? Have I ran into a bug, or am I configuring pubsub the wrong way? Should be easy to reproduce the two cases with the OpcPlc UA simulator

Best regards

cristipogacean commented 2 years ago

Hi, Unfortunately the -mm argument is only valid for publisher running in standalone mode. For orchestrated publisher the message mode is delivered within the job definition and is defaulted to Samples and there is no public API to change it. The only way to set message mode to PubSub is by manually changing the job definition in the cosmos DB storage.

We would highly appreciate if you could share your use-case and requirements for PubSub message mode in orchestrated configuration.

Thank you!

mwiot commented 2 years ago

Hi again, thanks for the reply. I have tried to do this in cosmosDB without luck. Have you tried to test your own suggestion to make sure that is works?

Steps (in cosmosdb)

When I switch to "messagingMode": "PubSub", the telemetry stops running. When I switch back to "messagingMode": "Samples" the telemetry starts going again.

image

image

image

Best regards

cristipogacean commented 2 years ago

Hi @mwiot,

It looks like you have just run in a regression. I can confirm that everything you did is correct and I can also replicate the issue. This bug will be fixed soon.

Thank you for your support!

VidarAndersstuen commented 2 years ago

Hi @cristipogacean ,

I thought I would share some background info on our use-case ...

We have a long history of being a supplier of turn-key solutions for Automation Control Systems with SCADA for operational services running on-prem inside the client's facilities.

We are mainly operating in the industries of Critical infrastructure for public sector and Smart Buildings

We are currently building a set of digital services for IoT running in Azure using IoT HUB with edge devices, Industrial IoT services, Digital Twins and Azure data Explorer and more.

Our business use-case is to extend our scope of services to provide a set of digital services from which our clients can gain more value from their OPC UA enabled OT-systems by providing secure access to OT-data and leveraging insights by reports, analytics and automated optimization feedback loops using ML and AI - all available as cloud services.

Our plattform can connect to other (3. party) service providers to combine external data sources for sensor telemetry with data from our own IoT edge systems AND provide context from our digital twins. The very same platform is also providing telemetry and context to any consumer service that require access to OT-data and are given access to it by the client.

In order for us to achieve this we must rely on industry standards and OPC UA is playing a key role in this domain, specifically with the OPC UA PubSub standard for cloud based IoT services. This format is an accepted industry standard for exchanging OT-data across cloud services.

Requirements

Vidar

mwiot commented 2 years ago

Hi again,

approx when can we expect the new container version being available in MCR, with the bug fix?

https://mcr.microsoft.com/v2/iot/industrial-iot-services-all/tags/list

Best regards

cristipogacean commented 2 years ago

Hi @mwiot,

We are in the final phase of releasing 2.8.1 version. We aim to have it available latest end of this week.

Kind regards

cristipogacean commented 2 years ago

Hi @teknokrat1,

Thank you very much for your feedback. This aligns very well with our strategy and plans. In the next iteration, we will be working on extending the configuration plane for the Publisher module that will cover PubSub message mode as well.

Kind regards, Cristian

marcschier commented 1 year ago

2.9 release will have full OPC UA Pub Sub support, but only through direct methods and publishednodes.json, not through orchestrated mode. Any additional work in orchestrated mode is not planned. Closing as the 2.9 release work is tracked through other issues.