MCPcopy Create free account
hub / github.com/StackStorm/st2 / __init__

Method __init__

st2common/st2common/services/sensor_watcher.py:35–61  ·  view source on GitHub ↗

:param create_handler: Function which is called on SensorDB create event. :type create_handler: ``callable`` :param update_handler: Function which is called on SensorDB update event. :type update_handler: ``callable`` :param delete_handler: Function which i

(
        self, create_handler, update_handler, delete_handler, queue_suffix=None
    )

Source from the content-addressed store, hash-verified

33
34class SensorWatcher(ConsumerMixin):
35 def __init__(
36 self, create_handler, update_handler, delete_handler, queue_suffix=None
37 ):
38 """
39 :param create_handler: Function which is called on SensorDB create event.
40 :type create_handler: ``callable``
41
42 :param update_handler: Function which is called on SensorDB update event.
43 :type update_handler: ``callable``
44
45 :param delete_handler: Function which is called on SensorDB delete event.
46 :type delete_handler: ``callable``
47 """
48 # TODO: Handle sensor type filtering using routing key
49 self._create_handler = create_handler
50 self._update_handler = update_handler
51 self._delete_handler = delete_handler
52 self._sensor_watcher_q = self._get_queue(queue_suffix)
53
54 self.connection = None
55 self._updates_thread = None
56
57 self._handlers = {
58 publishers.CREATE_RK: create_handler,
59 publishers.UPDATE_RK: update_handler,
60 publishers.DELETE_RK: delete_handler,
61 }
62
63 def get_consumers(self, Consumer, channel):
64 consumers = [

Callers

nothing calls this directly

Calls 1

_get_queueMethod · 0.95

Tested by

no test coverage detected