2.2.0 • Published 2 years ago
@mangar2/messagestore v2.2.0
Abstract
Provides a storage for Message trees and provides a rest interface to get chunks of the message tree
Contents
Meta
File | messagestore.js |
Abstract | Provides a storage for Message trees and provides a rest interface to get chunks of the message tree |
Author | Volker Böhm |
Copyright | Copyright ( c ) 2020 Volker Böhm |
License | This software is licensed under the GNU LESSER GENERAL PUBLIC LICENSE Version 3 . It is furnished "as is" , without any support , and with no warranty , express or implied , as to its usefulness for any purpose . |
Global functions
prepare
prepare (config, messagestore) => {MessageStore}
Prepares the object
prepare Parameters
Name | Type | Attribute | Default | Description | |
---|---|---|---|---|---|
config | Object | automation configuration | |||
messagestore | MessageStore | optional | null | existing automation class |
prepare returns
Type | Description |
---|---|
MessageStore | the prepared automation object |
Class MessageStore
new MessageStore(options)
Creates a message store object and configures it . Adds a listener for get requests
MessageStore Parameters
Name | Type | Attribute | Default | Description | |
---|---|---|---|---|---|
options | Object | optional | { } | message store parameters |
MessageStore Members
Name | Type | description |
---|---|---|
messages | MessageTree | Tree of messages |
MessageStore Methods
close
async close ()
Closes the broker , stops listening
getSubscriptions
getSubscriptions () => {Object}
Gets the required subscriptions for the Messagestore
getSubscriptions returns
Type | Description |
---|---|
Object | topic pattern : QoS value key/value object |
handleMessage
handleMessage (message)
Adds a message to the tree node matching to the topic path .
handleMessage Parameters
Name | Type | Description | |
---|---|---|---|
message | Message | { topic , value , reason } |
message properties
Name | Type | Description | |
---|---|---|---|
topic | string | topic string | |
value | Object | value of the topic | |
reason | Array.<Object> | list of reasons |
run
run ()
Listens to a configured port