buildListenerSet: Builds Listener Set from a a JSON configuration

View source: R/Listeners.R

buildListenerSetR Documentation

Builds Listener Set from a a JSON configuration

Description

This method builds a ListenerSet for an engine. In particular, the config is list which come from reading a JSON file (see fromJSON) which contains the rules for building the Listeners in the set.

Usage

buildListenerSet(sender, config, appid, lscol, dbname, dburi,
                 sslops, registrycol, registrydbname,
                 mongoverbose = FALSE)

Arguments

sender

A character scalar identifying the message sender.

config

A named list providing details of the contained listeners.

appid

A character scalar giving the application ID for the application being built.

lscol

A character scalar giving the name of the collection used for logging messages by the message set.

dbname

A character scalar giving the name of the database for the message log, as well as the default database for listeners.

dburi

A character scalar giving the URI of the mongo collection.

sslops

A list giving options for a SSL connection. See ssl_options.

registrycol

A character scalar giving the name of the colleciton for registering output.

registrydbname

A character scalar giving the name of the database in which the output registriation collection

mongoverbose

A flag for adding debugging information to Mongo calls (see MongoDB).

Details

This method builds the listener set starting by calling buildListener(config[[i]]) for each element of the config list. This then becomes the listeners to the ListenerSet constructor.

Note that the appid, dburi, dbnmae (mapped to defaultDB), and sslops are passed to buildListeners to use for defaults.

Value

An object of class ListenerSet.

Author(s)

Russell Almond

See Also

ListenerSet, buildListener

Examples


## Not run: 
jspecs <- '{
     "listeners":[
	{
	    "name":"ToAS",
	    "type":"InjectionListener",
	    "dbname":"ASRecords",
	    "colname":"Statistics",
	    "messages":["Statistics"]
	},
	{
	    "name":"PPStats",
	    "type":"UpdateListener",
	    "dbname":"Proc4",
	    "colname":"Statistics",
	    "targetField":"data",
	    "jsonEncoder":"stats2json",
	    "messages":["Statistics"]
	}

    ]}'

speclist <- jsonlite::fromJSON(jspecs,FALSE)

lset <- buildListenerSet("TestEngine",speclist$listeners,
                         "ecd://pluto.coe.fsu.edu/P4Test",
                         lscol="Messages",dbname="test",
                         dburi="", sslops=mongolite::ssl_options(),
                         registrycol="OutputFiles",
                         registrydbname="test")

## End(Not run)

ralmond/Proc4 documentation built on June 13, 2025, 7:13 a.m.