Question
· 9 hr ago

BusinessService Failed to create MQTT client

Hi Guys,

I've created Business service with MQTT Inbound Adapter and here is my settings, BTW I'm using an IP with port not sure if it must be a url?

 

and this is my class:

 

Class SX3.Production.MQTTService Extends Ens.BusinessService
{ Parameter ADAPTER = "EnsLib.MQTT.Adapter.Inbound"; Method OnProcessInput(pInput As %RegisteredObject, Output pOutput As %RegisteredObject) As %Status
{ set tsc=$$$OK
   set ^messageContent = pInput.StringValue
   
   Quit tsc
} }
 

 

 

 

But I'm getting the below error, not sure what I'm doing wrong?

 

Thanks

Product version: IRIS 2024.3
Discussion (1)1
Log in or sign up to continue

URL must have a scheme (either TCP or SSL). I don't think your (redacted) URL has a scheme.

If that does not help, try to init the object directly to see what's going on:

Set client=##class(%Net.MQTT.Client).%New(Url, ClientID, QOS, KeepAlive, LWTTopic, LWTMessage)

When creating a new client instance at minimum the url to connect and a client id is required to be specified.
The client id must be a utf-8 string which is used to uniquely identify the client.
This takes the form "tcp://localhost:1883" where the scheme is tcp and the host and port are seperated by a colon. If
you are using ssl you should specify the url in the form "ssl://localhost:8883" where scheme is ssl.
The second parameter is a string which the broker can use to identify the client. The client will generate an id if not specified.
The third parameter defines the required quality of service, 'Fire and Forget' (0) or 'Wait for Delivery' (1).

The fourth parameter is the keepalive interval, defaults to 60. 
The client will send keepalive messages to the broker according to the specified interval. The final pair of parameters specifies the last will and testament topic and associated message.
The LWT (last will and testament) feature tells the broker to deliver the Last Will message to the Last Will topic, should the client unexpectedly disconnect.

Note, %New() can error so it's important to check that the return value with $IsObject() and examine the %objlasterror status value should the %New() not return a valid object.