Creates a new instance of the persistence component.
(optional) a queue name.
The MQTT connection component.
The dependency resolver.
The logger.
Returnes message into the queue and makes it available for all subscribers to receive it again. This method is usually used to return a message which could not be processed at the moment to repeat the attempt. Messages that cause unrecoverable errors shall be removed permanently or/and send to dead letter queue.
Important: This method is not supported by MQTT.
a message to return.
(optional) callback function that receives an error or null for success.
Clears component state.
(optional) transaction id to trace execution through call chain.
callback function that receives error or null no errors occured.
Closes component and frees used resources.
(optional) transaction id to trace execution through call chain.
callback function that receives error or null no errors occured.
Permanently removes a message from the queue. This method is usually used to remove the message after successful processing.
Important: This method is not supported by MQTT.
a message to remove.
(optional) callback function that receives an error or null for success.
Configures component by passing configuration parameters.
configuration parameters to be set.
Ends listening for incoming messages. When this method is call listen unblocks the thread and execution continues.
(optional) transaction id to trace execution through call chain.
Checks if the component is opened.
true if the component has been opened and false otherwise.
Listens for incoming messages and blocks the current thread until queue is closed.
(optional) transaction id to trace execution through call chain.
a receiver to receive incoming messages.
Permanently removes a message from the queue and sends it to dead letter queue.
Important: This method is not supported by MQTT.
a message to be removed.
(optional) callback function that receives an error or null for success.
Opens the component.
(optional) transaction id to trace execution through call chain.
callback function that receives error or null no errors occured.
Peeks a single incoming message from the queue without removing it. If there are no messages available in the queue it returns null.
(optional) transaction id to trace execution through call chain.
callback function that receives a message or error.
Peeks multiple incoming messages from the queue without removing them. If there are no messages available in the queue it returns an empty list.
Important: This method is not supported by MQTT.
(optional) transaction id to trace execution through call chain.
a maximum number of messages to peek.
callback function that receives a list with messages or error.
Reads the current number of messages in the queue to be delivered.
callback function that receives number of messages or error.
Receives an incoming message and removes it from the queue.
(optional) transaction id to trace execution through call chain.
a timeout in milliseconds to wait for a message to come.
callback function that receives a message or error.
Renews a lock on a message that makes it invisible from other receivers in the queue. This method is usually used to extend the message processing time.
Important: This method is not supported by MQTT.
a message to extend its lock.
a locking timeout in milliseconds.
(optional) callback function that receives an error or null for success.
Sends a message into the queue.
(optional) transaction id to trace execution through call chain.
a message envelop to be sent.
(optional) callback function that receives error or null for success.
Sets references to dependent components.
references to locate the component dependencies.
Unsets (clears) previously set references to dependent components.
Generated using TypeDoc
Message queue that sends and receives messages via MQTT message broker.
MQTT is a popular light-weight protocol to communicate IoT devices.
Configuration parameters
References
*:logger:*:*:1.0
(optional) ILogger components to pass log messages*:counters:*:*:1.0
(optional) ICounters components to pass collected measurements*:discovery:*:*:1.0
(optional) IDiscovery services to resolve connections*:credential-store:*:*:1.0
(optional) Credential stores to resolve credentials*:connection:mqtt:*:1.0
(optional) Shared connection to MQTT service[[MessageQueue]]
[[MessagingCapabilities]]
Example
let queue = new MqttMessageQueue("myqueue"); queue.configure(ConfigParams.fromTuples( "topic", "mytopic", "connection.protocol", "mqtt" "connection.host", "localhost" "connection.port", 1883 )); queue.open("123", (err) => { ... }); queue.send("123", new MessageEnvelope(null, "mymessage", "ABC")); queue.receive("123", (err, message) => { if (message != null) { ... queue.complete("123", message); } });