# MQTT and OPC UA

MQTT definitions contain named brokers, subscriptions, optional last wills, and
TLS policy. Passwords and TLS key material are installation bindings. Subscription
topics point to existing Lua handlers.

OPC UA definitions contain named endpoints, authentication and channel-security
policy, and monitored node subscriptions. Passwords and client key material are
installation bindings. The compiler checks endpoint schemes, node IDs, paired
certificate/key requirements, queue sizes, sampling intervals, and handlers.

```xml
<edge-app format="1" handle="press-monitor" name="Press monitor">
  <config-schema>
    <schema type="object" xmlns="urn:cococo:json-schema:1">
      <additional-properties boolean="false"/>
      <property name="OPCUA_CLIENT_CERT" type="string" write-only="true"/>
      <property name="OPCUA_CLIENT_KEY" type="string" write-only="true"/>
      <property name="OPCUA_ENDPOINT" type="string"/>
      <property name="OPCUA_PASSWORD" type="string" write-only="true"/>
      <property name="OPCUA_USERNAME" type="string"/>
      <required name="OPCUA_ENDPOINT"/>
      <required name="OPCUA_USERNAME"/>
      <required name="OPCUA_PASSWORD"/>
      <required name="OPCUA_CLIENT_CERT"/>
      <required name="OPCUA_CLIENT_KEY"/>
    </schema>
  </config-schema>
  <handlers>
    <handler name="changed"><![CDATA[
bridge.log.info(params.nodeId)
return params.value
    ]]></handler>
  </handlers>
  <opcua-endpoints>
    <endpoint name="press" url="${config:OPCUA_ENDPOINT}" reconnect-interval-ms="5000">
      <auth mode="username" username="${config:OPCUA_USERNAME}">
        <password config="OPCUA_PASSWORD"/>
      </auth>
      <security policy="basic256-sha256" mode="sign-and-encrypt">
        <client-cert config="OPCUA_CLIENT_CERT"/>
        <client-key config="OPCUA_CLIENT_KEY"/>
      </security>
      <subscriptions>
        <subscription node-id="ns=2;s=PressTemp" handler="changed" sampling-ms="500" queue-size="2"/>
      </subscriptions>
    </endpoint>
  </opcua-endpoints>
</edge-app>
```