• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Protocols - MQTT I/O
  • Publisher
  • 5.0.0

Topics Subscriber

Publisher

Publisher

The Publisher is a Sequencer block, that can be used to publish data to the MQTT (Message Queue Telemetry Transport) network via Sequencer Events.

Publisher has no MQTT client functionality included in the block. Therefore, to be able to send MQTT data, Publisher has to be connected to a MQTTClient first, via the MQTTClient connector, as is shown in the following block diagram:

Note: There is a limitation: the Publisher and the MQTTClient it is connected to must reside inside of the same CDP application.

Publisher can be connected to MQTTClient also via the MQTTClientRPC router block(s). Routing via one or many MQTTClientRPC blocks can be handy when the Publisher and the MQTTClient are in different levels of application.

Events

NameInput/OuptutDescription
ConnectedOutputWill be emitted when the MQTTClient has established the connection with the configured broker
DisconnectedOutputWill be emitted when the MQTTClient has lost the connection with the configured broker
PublishInputInvokes publishing of Payload data to the Topic. Can contain other arguments that modify the MQTT publishing behavior.
PublishedOutputWill be emitted when MQTTClient has successfully published the data from Publish event. Will contain all the arguments of the original Publish event plus a MessageID argument.
PublishFailedOutputWill be emitted when MQTTClient was not able to publish the data from Publish event. Will contain all the arguments of the original Publish event plus an Error argument.

Arguments

NameDescription
TopicMQTT topic string for the message to be published
PayloadMQTT payload for the message to be published.
QoSQuality of service level of broker communication. Possible values are 0 (Deliver at most once), 1 (Deliver at least once) or 2 (Deliver exactly once).
RetainDefines if the broker should retain the last message sent. If true, then for any new subscriber on this topic, the retained message will be sent immediately.
AutoAliasGenerate MQTT v5 topic alias on first publish to save network traffic on consequent sends when the same Topic string is used. Can be used only when MQTTClient ProtocolVersion is set to v5 (or higher) and the broker also supports MQTT v5 (or higher).
ResponseTopicWhen filled, indicates a topic that the request publisher expects the response to be published to. Can be used only when MQTTClient ProtocolVersion is set to v5 (or higher) and the broker also supports MQTT v5 (or higher).
CorrelationDataWhen filled, identifies the specific request and should be echoed back by repsonder when it responds to the ResponseTopic. Can be used only when MQTTClient ProtocolVersion is set to v5 (or higher) and the broker also supports MQTT v5 (or higher).
MessageIDOn successful publish (Published event), contains MQTT message ID of the outgoing message. MessageID is available only when QoS > 0.
ErrorOn failure (PublishFailed event), contains the error message describing the failure reason

Properties

NameDescription
PendingCountPending Publish events - i.e. events with no Publised or PublishFailed response from MQTTClient

Note: When you need to publish Payloads, which can contain non-printable or zero characters, you have to set the Command attribute of Publish event to any value other than CM_TEXTCOMMAND (`20100_16`), that will instruct the CDP to receive the event data in binary form. Make sure you set the Command attribute to the very same value on the event sender side. Also, make sure that the argument order is exactly the same on the event sender side.

See also Subscriber and MQTTClient.

Topics Subscriber

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top