StackHub Bulletin BoardAdvertise your announcements here!

pahoMqttSub

Paho MQTT Subscriber
pahoMqttSubAxon funcs

Registered StackHub users may elect to receive email notifications whenever a new package version is released or a comment is posted on the forum.

There are 0 watchers.

v1.0.0

pahoMqttSubscriberAdd
pahoMqttSubscriberAdd(sub, password: null)

Create a new pahoMqttSubscriber record and register it within the list of Subscribers being managed.

The brokerUrl must be provided and must be a URI.

The topics must be provided and must be a List of Str.

The parser must be provided. This should match the name of an Axon function that takes two Str parameters: (topic, message). This parser will be used for all messages from all the topics listed.

The qos is optional and will default to 1. See MQTT Docs for details on QOS.

If username is provided, then the optional second parameter for password is also expected. These will be supplied to the broker on connection. If you have a non-authenticating broker, just leave out username and drop the second parameter.

Examples:

pahoMqttSubscriberAdd({brokerUrl:`tcp://host:1883`, topics:["topic/one","topic/two"], parser:"myMsgParser", qos:1})
pahoMqttSubscriberAdd({brokerUrl:`tcp://host:1883`, topics:["topic/one","topic/two"], parser:"myMsgParser", username:"username"}, "password")

Side effects:

  • Adds a new record to folio with the marker tag pahoMqttSubscriber combined with the tags from the provided Dict
  • If a username and password are provided, the password will be stored in the password db keyed by the pahoMqttSubscriber folio record id.
Fantom signature:
@Axon { admin=true; } static Dict pahoMqttSubscriberAdd(Dict sub, Str? password := null)
pahoMqttSubscriberDelete
pahoMqttSubscriberDelete(ref)

Delete a Subscriber passing the Ref ID of the folio record corresponding to it.

The Ref provided must match a record found in folio.

Examples:

pahoMqttSubscriberDelete(@p:proj1:r:255481c1-42be3946)

Side effects:

  • Unsubscribes from all topics
  • Disconnects the Subscriber from the Broker
  • Deletes the record from folio
Fantom signature:
@Axon { admin=true; } static Void pahoMqttSubscriberDelete(Ref ref)
pahoMqttSubscriberStart
pahoMqttSubscriberStart(ref)

Start a Subscriber passing the Ref ID of the folio record corresponding to it.

The Ref provided must match a record found in folio.

Examples:

pahoMqttSubscriberStart(@p:proj1:r:255481c1-42be3946)

Side effects:

  • Connects the Subscriber to the Broker at the URL specified in its folio record
  • Subscribes to all topics listed
  • Returns the record with the transient running tag set to true if it succeeded in starting
Fantom signature:
@Axon { admin=true; } static Dict pahoMqttSubscriberStart(Ref ref)
pahoMqttSubscriberStartAll
pahoMqttSubscriberStartAll()

Start all Subscribers.

Examples:

pahoMqttSubscriberStartAll()

Side effects:

  • All Subscribers started
  • Returns the list of subscribers
Fantom signature:
@Axon { admin=true; } static Grid pahoMqttSubscriberStartAll()
pahoMqttSubscriberStop
pahoMqttSubscriberStop(ref)

Stop a Subscriber passing the Ref ID of the folio record corresponding to it.

The Ref provided must match a record found in folio.

Examples:

pahoMqttSubscriberStop(@p:proj1:r:255481c1-42be3946)

Side effects:

  • Unsubscribes from all topics
  • Disconnects the Subscriber from the Broker
  • Returns the record with the transient running tag set to false if it succeeded in stopping
Fantom signature:
@Axon { admin=true; } static Dict pahoMqttSubscriberStop(Ref ref)
pahoMqttSubscriberStopAll
pahoMqttSubscriberStopAll()

Stop all Subscribers.

Examples:

pahoMqttSubscriberStopAll()

Side effects:

  • All Subscribers stopped
  • Returns the list of subscribers
Fantom signature:
@Axon { admin=true; } static Grid pahoMqttSubscriberStopAll()
Published by Crowley Carbon

Packages by Crowley Carbon

Free packages