2.2.0 • Published 2 years ago

@mangar2/messagestore v2.2.0

Weekly downloads
10
License
LGPL-3.0-or-later
Repository
github
Last release
2 years ago

Abstract

Provides a storage for Message trees and provides a rest interface to get chunks of the message tree

Contents

Meta

Filemessagestore.js
AbstractProvides a storage for Message trees and provides a rest interface to get chunks of the message tree
AuthorVolker Böhm
CopyrightCopyright ( c ) 2020 Volker Böhm
LicenseThis 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

NameTypeAttributeDefaultDescription
configObjectautomation configuration
messagestoreMessageStoreoptionalnullexisting automation class

prepare returns

TypeDescription
MessageStorethe prepared automation object

Class MessageStore

new MessageStore(options)

Creates a message store object and configures it . Adds a listener for get requests

MessageStore Parameters

NameTypeAttributeDefaultDescription
optionsObjectoptional{ }message store parameters

MessageStore Members

NameTypedescription
messagesMessageTreeTree of messages

MessageStore Methods

close

async close ()

Closes the broker , stops listening

getSubscriptions

getSubscriptions () => {Object}

Gets the required subscriptions for the Messagestore

getSubscriptions returns
TypeDescription
Objecttopic pattern : QoS value key/value object

handleMessage

handleMessage (message)

Adds a message to the tree node matching to the topic path .

handleMessage Parameters
NameTypeDescription
messageMessage{ topic , value , reason }

message properties

NameTypeDescription
topicstringtopic string
valueObjectvalue of the topic
reasonArray.<Object>list of reasons

run

run ()

Listens to a configured port