In PubSub the participating OPC UA Applicationscan assume the roles Publisher and Subscriber. Publishersare the sources of data, while Subscribers consume that data. Communication in PubSubis message-based. Publisherssend messages to a Message Oriented Middleware, without knowledge of what, if any, Subscribersthere may be. Similarly, Subscribersexpress interest in specific types of data, and process messages that contain this data, without knowledge of what Publishersthere are.
Message Oriented Middlewareis software or hardware infrastructure that supports sending and receiving messages between distributed systems. The implementation of this distribution depends on the Message Oriented Middleware.
Figure 1illustrates that Publishersand Subscribersonly interact with the Message Oriented Middlewarewhich provides the means to forward the data to one or more receivers.
Figure 1– Publish Subscribe Model Overview
To cover a large number of use cases, OPC UA PubSubsupports two largely different Message Oriented Middlewarevariants. These are:
- A broker-less form, where the Message Oriented Middlewareis the network infrastructure that is able to route datagram-based messages. Subscribersand Publishersuse datagram protocols like UDP.
- A broker-based form, where the core component of the Message Oriented Middlewareis a message Broker. Subscribersand Publishersuse standard messaging protocols like AMQP or MQTT to communicate with the Broker. All messages are published to specific queues (e.g. topics, nodes) that the Brokerexposes and Subscriberscan listen to these queues. The Brokermay translate messages from the formal messaging protocol of the Publisherto the formal messaging protocol of the Subscriber.