I like to check with you if this is possible :
- Currently i successfully implemented opcua pubsub of a set of variables to a mqtt broker. I can inspect the data on the broker as it is encoded using json.
- Now I want to do the reverse:
2a. A new opcua client will publish a request to invoke opcua methodcalls via mqtt.
2b. The opcua server will listen (subscribed) for this request; when it receives the subscribed request it will invoke the corresponding methodcalls and return the result back to the broker by publishing to it;
Based on the sample codes in open62541.org that implements opcua-mqtt subscriber, it seemed to me that the architecture supported by opcua-mqtt pubsub is as follows:
opcserver1 (publisher) —> mqtt —> opcserver2 (subscriber) <- opcclient
All data published to the mqtt has to be populated into opcserver2 as nodes.
for methodcalls involved by opcclient, it will read off from opcserver2 without going to opcserver1. Reason is opcserver1 would have published all the metadata and sent to opcserver2.
Please confirm if my understanding is correct.
- The opcua client in turns subscribe to this results
The mapping to variables in the OPC UA server is an optional feature.
A server could do anything it wants with the message including reporting an event containing the dataset.
You could implement a method call with by subscribing to the variables but you could never really when the method is "called" since you could receive updates at slightly different times for each variable or never get an update at all if the current parameters are the same as the previous parameters.
The only reliable to way to implement this is with an event rather than variables.
The same problem exists for returning the response. Writing to multiple variables cannot guarantee that the values will be sent in the same message. You would need a method on opcserver2 to guarantee that the response is sent correctly.