abstract class EnsLib.MQTT.Adapter.Common
extends Ens.Adapter, %Net.MQTT.Logger
parameter DOMAIN = "EnsMQTT";
Domain for $$$Text()
parameter SETTINGS = "CleanSession:MQTT,ClientID:MQTT,ConnectTimeout:MQTT,CredentialsName:MQTT:credentialsSelector,KeepAlive:MQTT,LWTTopic:MQTT,LWTMessage:MQTT,QOS:MQTT,Retained:MQTT,SSLConfigName:MQTT:sslConfigSelector,Timeout:MQTT,Topic:MQTT,Trace:MQTT,TraceLevel:MQTT,Url:MQTT";
Configurable settings
property CleanSession
as %Boolean [ InitialExpression = 1 ];
This determines if the session to the broker will use a clean session.
property ClientID
as %String(MAXLEN="");
This is the string which identifies this client to the broker. It must be ascii encoded.
For compatibility the recommended length of this identifier is 23 characters or less but note that certain server implementations permit more.
If not specified the client will create a unique id in the form '73BDD334-83D4-11EA-8229'.
property ConnectTimeout
as %Integer [ InitialExpression = 30 ];
This is the connect timeout. Connecting to a busy server may take some time and this timeout can be used
to avoid a premature connection failure.
property CredentialsName
as %String;
This is the ID name of the set of credentials values to be used to access the MQTT broker.
The Username and password defined in your Credentials item must be ascii encoded. Not required
if the broker is insecured.
property KeepAlive
as %Integer [ InitialExpression = $$$KeepAliveInterval ];
The client will send keepalive messages to the broker according to the specified interval.
property LWTMessage
as %String;
This is the LWT (Last Will And Testament) message. If specified must be ascii encoded.
property LWTTopic
as %String;
This the LWT (Last Will And Testament) Topic. If specified must be ascii encoded.
If the client disconnects due to an network error, the LWTMessage will be delivered
to subscribers to the LWTTopic.
property QOS
as %Integer [ InitialExpression = $$$QOSFireAndForget ];
This determines the quality of service required, $$$QOSWaitForDelivery or $$$QOSFireAndForget
property Retained
as %Boolean [ InitialExpression = 0 ];
This is the flag that indicates to the broker whether the message should be retained
by the broker
property SSLConfigName
as %String;
This is the ID name of the SSL configuration that you wish to be used to communicate with the broker.
Only used if in fact SSL communication is required.
property Status
as %String [ InitialExpression = "Created" ];
This is the internal status of the adapter
property Timeout
as %Numeric(MINVAL="0.1") [ InitialExpression = 1 ];
This is the timeout expressed in seconds to wait to send (with ack ) or receive a message
property Topic
as %String;
This is the topic name of the topic to which you wish to publish or subscribe.
The topic must be ascii encoded
property Trace
as %Boolean [ InitialExpression = 0 ];
This enables or disables the MQTT tracing facility
property TraceLevel
as %Integer [ InitialExpression = $$$MQTTCLIENTTRACEFATAL ];
This is the trace level for the MQTT library. Set this to log the required detail of trace information
See %Net.MQTT.inc for legal values
property Url
as %String(MAXLEN="");
This is the url of the broker to which you wish to communicate. The scheme is either 'tcp' or 'ssl' followed by the
domain name and port delimited by a ':', for example, 'tcp://BIGBADAPPLE.local:1883'. Typically ssl enabled end points
are configured with a port of 8883 but this is not mandatory. The url must be ascii encoded.
method Connect()
as %Status
method Log(level As %Integer, message As %String)
Simply log the value
method OnInit()
as %Status
This user callback method is called just after %OnNew()
method StatusSet(value)
as %Status
Setter override for status value