Components¶
-
class
wishbone.queue.
Queue
(max_size=1)[source]¶ Bases:
object
A queue used to organize communication messaging between Wishbone Actors.
Parameters: max_size¶ (-) – The max number of elements in the queue. Default: 1 When a queue is created, it will drop all messages. This is by design. When <disableFallThrough()> is called, the queue will keep submitted messages. The motivation for this is that when is queue is not connected to any consumer it would just sit there filled and possibly blocking the chain.
The <stats()> function will reveal whether any events have disappeared via this queue.
-
class
wishbone.queue.
QueuePool
(size)[source]¶ Bases:
object
-
createSystemQueue
(name)[source]¶ Creates a queue starting with _ which is forbidden by users as special system queues are prefixed with ‘_’.
This method should normally never be used directly because of user input. It’s the Wishbone framework itself which should make system related queues.
Parameters: name¶ – The name of the queue (should start with _)
-
-
class
wishbone.logging.
Logging
(name, q, identification=None)[source]¶ Bases:
object
Generates Wishbone formatted log messages following the Syslog priority definition.
-
crit
(message, *args, **kwargs)¶ Generates a log message with priority critical(2).
-
emerg
(message, *args, **kwargs)¶ Generates a log message with priority emergency(0).
-
err
(message, *args, **kwargs)¶ Generates a log message with priority error(3).
-
exception
(message, *args, **kwargs)¶ Generates a log message with priority emergency(0).
-
info
(message, *args, **kwargs)¶ Generates a log message with priority informational(6).
-
informational
(message, *args, **kwargs)[source]¶ Generates a log message with priority informational(6).
-
warn
(message, *args, **kwargs)¶ Generates a log message with priority warning(4).
-
-
class
wishbone.config.
ConfigFile
(filename, logstyle, loglevel=6, identification='wishbone', colorize_stdout=True)[source]¶ Generates a wishbone.router configuration object used to initialize a wishbone router object.
This config generator has some tailered functionality which makes it suitable when bootstrapping from CLI.
It does following automatic configurations:
Initializes a
wishbone.module.flow.funnel
module called_logs
which is connected to the_logs
queue of all modules except if this module has already been connected in the bootstrap file.Initializes a
wishbone.module.flow.funnel
module called_metrics
which is connected to the_metrics
queue of all modules except if this module has already been connected in the bootstrap file. The_metrics
modules is by default not connected to any other modules. The effect of this is that all metrics are dropped unless the user connects a module for furhter processing the metrics.Adds a
wishbone.module.flow.queueselect
module called_logs_filter
responsible for dropping logs which log level do not correspond to the define--log-level
Adds either a
wishbone.module.output.stdout
called_logs_stdout
module orwishbone.module.output.syslog
module called_logs_syslog
and connects this instance to_logs.outbox
.Initializes the following template functions and makes them available to each initialized module:
- strftime() - env() - epoch() - version()
Parameters: - filename¶ – The filename of the configuration to load.
- logstyle¶ – How logging should be setup. Possible options are: stdout and syslog.
- loglevel¶ – The loglevel for the router to use to use.
- identification¶ – A string which identifies the router instance
- colorize_stdout¶ – When True, colors each stdout printed logline using proper coloring.
-
addConnection
(source_module, source_queue, destination_module, destination_queue)[source]¶ Adds connections between module queues.
Parameters:
-
addModule
(name, module, arguments={}, description='', functions={}, protocol=None, event=False)[source]¶ Adds a module to the configuration.
Parameters: - name¶ – The module instance name
- module¶ – The module name
- arguments¶ – The module variables
- description¶ – A description of the module instance
- functions¶ – The module functions
- protocol¶ – The protocol to apply to the module
- event¶ – Whether incoming or outgoing events need to be treated as full events.
-
addModuleFunction
(name, function, arguments={})[source]¶ Adds a module function to the configuration.
Parameters:
-
class
wishbone.queue.
QueuePool
(size)[source] -
createQueue
(name)[source] Creates a Queue.
-
createSystemQueue
(name)[source] Creates a queue starting with _ which is forbidden by users as special system queues are prefixed with ‘_’.
This method should normally never be used directly because of user input. It’s the Wishbone framework itself which should make system related queues.
Parameters: name¶ – The name of the queue (should start with _)
-
getQueue
(name)[source] Convenience funtion which returns the queue instance.
-
hasQueue
(name)[source] Returns <True> when queue with <name> exists.
-
join
()[source] Blocks until all queues in the pool are empty.
-
listQueues
(names=False, default=True)[source] returns the list of queue names from the queuepool.
-