Actor¶
-
class
wishbone.actor.
Actor
(config)[source]¶ Bases:
object
A base class providing core Actor functionality.
The Actor base class is responsible for providing the base functionality, setup and helper functions of a Wishbone module.
Parameters: config¶ – The ActorConfig object instance. -
config
¶ wishbone.actorconfig.ActorConfig – The ActorConfig object instance.
-
name
¶ str – The name of the instance, derived from config.
-
description
¶ str – The description of the actor based instance, derived from config.
pool (wishbone.pool.QueuePool): The Actor’s queue pool.
-
logging
(wishbone.logging.Logging)¶
-
generateEvent
(data={}, destination=None)[source]¶ Generates a new event.
This function can get overridden by
wishbone.module.InputModule._generateNativeEvent
.The provided
data
will be traversed in search of valid templates which then will be rendered.Parameters: Returns: An event containing
data
as a payload.Return type:
-
loop
()[source]¶ The global lock for this module.
Returns: True when module is in running mode. False if not. Return type: bool
-
registerConsumer
(function, queue)[source]¶ Registers <function> to process all events in <queue>
Don’t not trap errors here. When <function> fails then the event will be submitted to the “failed” queue, If <function> succeeds to the success queue.
Registering
function
to consumequeue
will also apply all the registered module functions against the events consumed from it.Parameters: Returns: None
-
renderEventKwargs
(event, queue=None)[source]¶ Renders kwargs using the content of
event
and stores the result underevent.kwargs
.Parameters: Returns: The provided event instance.
Return type: wishbone.event.Event
-
renderKwargs
()[source]¶ Renders kwargs without making use of event content. This is typically used when initiliazing a module and render the defined kwargs which do not need a event data for rendering.
Returns: None
-
sendToBackground
(function, *args, **kwargs)[source]¶ Executes a function and sends it to the background. Such a function should never exit until
self.loop
returnsFalse
. This method wrapsfunction
again in a loop as longself.loop
returnsFalse
so thatfunction
is restarted and an error is logged.Parameters:
-