Exemplo n.º 1
0
 def notify(self, event_id, **kwargs):
     notification = Notification(
         event_id,
         self._send_notification,
         self.json_binding.bridge
     )
     notification.emit(**kwargs)
Exemplo n.º 2
0
    def notify(self, event_id, params=None):
        if not params:
            params = {}

        notification = Notification(event_id, self._send_notification,
                                    self.json_binding.bridge.event_schema)
        notification.emit(params)
Exemplo n.º 3
0
    def notify(self, event_id, params=None):
        if not params:
            params = {}

        notification = Notification(
            event_id,
            self._send_notification,
            self.json_binding.bridge.event_schema
        )
        notification.emit(params)
Exemplo n.º 4
0
 def notify(self, event_id, **kwargs):
     """
     Send notification using provided subscription id as
     event_id and a dictionary as event body. Before sending
     there is notify_time added on top level to the dictionary.
     """
     notification = Notification(
         event_id,
         self._send_notification,
     )
     notification.emit(**kwargs)
Exemplo n.º 5
0
 def notify(self, event_id, **kwargs):
     """
     Send notification using provided subscription id as
     event_id and a dictionary as event body. Before sending
     there is notify_time added on top level to the dictionary.
     """
     notification = Notification(
         event_id,
         self._send_notification,
     )
     notification.emit(**kwargs)
Exemplo n.º 6
0
    def notify(self, event_id, params=None, destination=None):
        if not params:
            params = {}

        if destination is None:
            destination = self.dest

        server = self.json_binding.reactor.server

        notification = Notification(
            event_id, lambda message: server.send(message, destination),
            self.json_binding.bridge.event_schema)
        notification.emit(params)
Exemplo n.º 7
0
    def notify(self, event_id, params=None, destination=None):
        if not params:
            params = {}

        if destination is None:
            destination = self.dest

        server = self.json_binding.reactor.server

        notification = Notification(
            event_id,
            lambda message: server.send(message, destination),
            self.json_binding.bridge.event_schema
        )
        notification.emit(params)
Exemplo n.º 8
0
    def notify(self, event_id, **kwargs):
        """
        Send notification using provided subscription id as
        event_id and a dictionary as event body. Before sending
        there is notify_time added on top level to the dictionary.
        """
        if not self.ready:
            self.log.warning('Not ready yet, ignoring event %r args=%r',
                             event_id, kwargs)
            return

        notification = Notification(
            event_id,
            self._send_notification,
        )
        notification.emit(**kwargs)
Exemplo n.º 9
0
    def notify(self, event_id, **kwargs):
        """
        Send notification using provided subscription id as
        event_id and a dictionary as event body. Before sending
        there is notify_time added on top level to the dictionary.
        """
        if not self.ready:
            self.log.warning('Not ready yet, ignoring event %r args=%r',
                             event_id, kwargs)
            return

        notification = Notification(
            event_id,
            self._send_notification,
        )
        notification.emit(**kwargs)
Exemplo n.º 10
0
    def notify(self, event_id, dest, event_schema, params=None):
        """
        JsonRpcClient notify method, sends an event on a spesific queue

        Args:
            event_id (string): unique event name
            dest (string): destination queue
            event_schema (Schema): a schema for vdsm events
            params (dict): event content

        Returns:
            None
        """
        if not params:
            params = {}

        def send_notification(message):
            self._transport.send(message, dest)

        notification = Notification(event_id, send_notification, event_schema)
        notification.emit(params)
Exemplo n.º 11
0
    def notify(self, event_id, dest, event_schema, params=None):
        """
        JsonRpcClient notify method, sends an event on a spesific queue

        Args:
            event_id (string): unique event name
            dest (string): destination queue
            event_schema (Schema): a schema for vdsm events
            params (dict): event content

        Returns:
            None
        """
        if not params:
            params = {}

        def send_notification(message):
            self._transport.send(message, dest)

        notification = Notification(event_id, send_notification, event_schema)
        notification.emit(params)
Exemplo n.º 12
0
    def notify(self, event_id, **kwargs):
        """
        Send notification using provided subscription id as
        event_id and a dictionary as event body. Before sending
        there is notify_time added on top level to the dictionary.
        """
        if not self.ready:
            self.log.warning('Not ready yet, ignoring event %r args=%r',
                             event_id, kwargs)
            return

        json_binding = self.bindings['jsonrpc']

        def _send_notification(message):
            json_binding.reactor.server.send(
                message, config.get('addresses', 'event_queue'))

        try:
            notification = Notification(event_id, _send_notification,
                                        json_binding.bridge)
            notification.emit(**kwargs)
        except KeyError:
            self.log.warning("Attempt to send an event when jsonrpc binding"
                             " not available")
Exemplo n.º 13
0
    def notify(self, event_id, params=None):
        """
        Send notification using provided subscription id as
        event_id and a dictionary as event body. Before sending
        there is notify_time added on top level to the dictionary.

        Please consult event-schema.yml in order to build an appropriate event.
        https://github.com/oVirt/vdsm/blob/master/lib/api/vdsm-events.yml

        Args:
            event_id (string): unique event name
            params (dict): event content
        """
        if not params:
            params = {}

        if not self.ready:
            self.log.warning('Not ready yet, ignoring event %r args=%r',
                             event_id, params)
            return

        json_binding = self.servers['jsonrpc']

        def _send_notification(message):
            json_binding.reactor.server.send(
                message, config.get('addresses', 'event_queue'))

        try:
            notification = Notification(event_id, _send_notification,
                                        json_binding.bridge.event_schema)
            notification.emit(params)
            self.log.debug("Sending notification %s with params %s ", event_id,
                           params)
        except KeyError:
            self.log.warning("Attempt to send an event when jsonrpc binding"
                             " not available")
Exemplo n.º 14
0
    def notify(self, event_id, params=None):
        """
        Send notification using provided subscription id as
        event_id and a dictionary as event body. Before sending
        there is notify_time added on top level to the dictionary.

        Please consult event-schema.yml in order to build an appropriate event.
        https://github.com/oVirt/vdsm/blob/master/lib/api/vdsm-events.yml

        Args:
            event_id (string): unique event name
            params (dict): event content
        """
        if not params:
            params = {}

        if not self.ready:
            self.log.warning('Not ready yet, ignoring event %r args=%r',
                             event_id, params)
            return

        json_binding = self.servers['jsonrpc']

        def _send_notification(message):
            json_binding.reactor.server.send(
                message, config.get('addresses', 'event_queue'))

        try:
            notification = Notification(event_id, _send_notification,
                                        json_binding.bridge.event_schema)
            notification.emit(params)
            self.log.debug("Sending notification %s with params %s ",
                           event_id, params)
        except KeyError:
            self.log.warning("Attempt to send an event when jsonrpc binding"
                             " not available")
Exemplo n.º 15
0
    def notify(self, event_id, **kwargs):
        """
        Send notification using provided subscription id as
        event_id and a dictionary as event body. Before sending
        there is notify_time added on top level to the dictionary.
        """
        if not self.ready:
            self.log.warning('Not ready yet, ignoring event %r args=%r',
                             event_id, kwargs)
            return

        json_binding = self.bindings['jsonrpc']

        def _send_notification(message):
            json_binding.reactor.server.send(
                message, config.get('addresses', 'event_queue'))

        try:
            notification = Notification(event_id, _send_notification,
                                        json_binding.bridge)
            notification.emit(**kwargs)
        except KeyError:
            self.log.warning("Attempt to send an event when jsonrpc binding"
                             " not available")
Exemplo n.º 16
0
 def notify(self, event_id, **kwargs):
     notification = Notification(
         event_id,
         self._send_notification,
     )
     notification.emit(**kwargs)
Exemplo n.º 17
0
 def notify(self, event_id, **kwargs):
     notification = Notification(event_id, self._send_notification,
                                 self.json_binding.bridge)
     notification.emit(**kwargs)
Exemplo n.º 18
0
 def notify(self, event_id, **kwargs):
     notification = Notification(
         event_id,
         self._send_notification,
     )
     notification.emit(**kwargs)