Callback invoked when the server acknowledges the QoS settings.

        Asserts or creates the exchanges and queues exist.

        Args:
            qosok_frame (pika.spec.Basic.Qos): The frame send from the server.
971512
def _on_qosok(self, qosok_frame):
        
        for name, args in self._exchanges.items():
            self._channel.exchange_declare(
                exchange=name,
                exchange_type=args["type"],
                durable=args["durable"],
                auto_delete=args["auto_delete"],
                arguments=args["arguments"],
                passive=config.conf["passive_declares"],
                callback=self._on_exchange_declareok,
            )
        for name, args in self._queues.items():
            self._channel.queue_declare(
                queue=name,
                durable=args["durable"],
                auto_delete=args["auto_delete"],
                exclusive=args["exclusive"],
                arguments=args["arguments"],
                passive=config.conf["passive_declares"],
                callback=self._on_queue_declareok,
            )
14298
def start_accepting_passive_svc_checks(self):
        
        # todo: #783 create a dedicated brok for global parameters
        if not self.my_conf.accept_passive_service_checks:
            self.my_conf.modified_attributes |= DICT_MODATTR["MODATTR_PASSIVE_CHECKS_ENABLED"].value
            self.my_conf.accept_passive_service_checks = True
            self.my_conf.explode_global_conf()
            self.daemon.update_program_status()
749364
def _send_mbus(self, frame):
        
        # for auto_open mode, check TCP and open if need
        if self.__auto_open and not self.is_open():
            self.open()
        # send request
        bytes_send = self._send(frame)
        if bytes_send:
            if self.__debug:
                self._pretty_dump('Tx', frame)
            return bytes_send
        else:
            return None
1199271
def set_qos(self, port_name, type='linux-htb', max_rate=None, queues=None):
        
        queues = queues if queues else []
        command_qos = ovs_vsctl.VSCtlCommand(
            'set-qos',
            [port_name, type, max_rate])
        command_queue = ovs_vsctl.VSCtlCommand(
            'set-queue',
            [port_name, queues])
        self.run_command([command_qos, command_queue])
        if command_qos.result and command_queue.result:
            return command_qos.result + command_queue.result
        return None
1235786
async def observer_poll(self, message):
        """"""
        # Sleep until we need to notify the observer.
        await asyncio.sleep(message['interval'])

        # Dispatch task to evaluate the observable.
        await self.channel_layer.send(
            CHANNEL_WORKER, {'type': TYPE_EVALUATE, 'observer': message['observer']}
        )
879621
def _send_start_ok(self, frame_in):
        
        mechanisms = try_utf8_decode(frame_in.mechanisms)
        if 'EXTERNAL' in mechanisms:
            mechanism = 'EXTERNAL'
            credentials = '\0\0'
        elif 'PLAIN' in mechanisms:
            mechanism = 'PLAIN'
            credentials = self._plain_credentials()
        else:
            exception = AMQPConnectionError(
                'Unsupported Security Mechanism(s): %s' %
                frame_in.mechanisms
            )
            self._connection.exceptions.append(exception)
            return
        start_ok_frame = specification.Connection.StartOk(
            mechanism=mechanism,
            client_properties=self._client_properties(),
            response=credentials,
            locale=LOCALE
        )
        self._write_frame(start_ok_frame)
763600
def subscribe(self, frame):
        
        ack = frame.headers.get('ack')
        reliable = ack and ack.lower() == 'client'

        self.engine.connection.reliable_subscriber = reliable

        dest = frame.headers.get('destination')
        if not dest:
            raise ProtocolError('Missing destination for SUBSCRIBE command.')

        if dest.startswith('/queue/'):
            self.engine.queue_manager.subscribe(self.engine.connection, dest)
        else:
            self.engine.topic_manager.subscribe(self.engine.connection, dest)
232843
def ack(self):
        
        if self.acknowledged:
            raise self.MessageStateError(
                "Message already acknowledged with state: %s" % self._state)
        self.backend.ack(self._frame)
        self._state = "ACK"
494948
def setup_suspend(self):
        
        self.frame_calling = None
        self.frame_stop = None
        self.frame_return = None
        self.frame_suspend = True
        self.pending_stop = True
        self.enable_tracing()
        return
679167
def qos(self, prefetch_size=0, prefetch_count=0, is_global=False):
        '''
        
        '''
        args = Writer()
        args.write_long(prefetch_size).\
            write_short(prefetch_count).\
            write_bit(is_global)
        self.send_frame(MethodFrame(self.channel_id, 60, 10, args))

        self.channel.add_synchronous_cb(self._recv_qos_ok)
798946
def on_response(self, ch, method_frame, props, body):
        
        LOGGER.debug("rabbitmq.Requester.on_response")
        if self.corr_id == props.correlation_id:
            self.response = {'props': props, 'body': body}
        else:
            LOGGER.warn("rabbitmq.Requester.on_response - discarded response : " +
                        str(props.correlation_id))
            LOGGER.debug("natsd.Requester.on_response - discarded response : " + str({
                'properties': props,
                'body': body
            }))
944645
def _on_channel_open(self, channel):
        
        channel.add_on_close_callback(self._on_channel_close)
        channel.add_on_cancel_callback(self._on_cancel)

        channel.basic_qos(callback=self._on_qosok, **config.conf["qos"])
998210
def on_frame(self, frame_in):
        
        LOGGER.debug('Frame Received: %s', frame_in.name)
        if frame_in.name == 'Heartbeat':
            return
        elif frame_in.name == 'Connection.Close':
            self._close_connection(frame_in)
        elif frame_in.name == 'Connection.CloseOk':
            self._close_connection_ok()
        elif frame_in.name == 'Connection.Blocked':
            self._blocked_connection(frame_in)
        elif frame_in.name == 'Connection.Unblocked':
            self._unblocked_connection()
        elif frame_in.name == 'Connection.OpenOk':
            self._set_connection_state(Stateful.OPEN)
        elif frame_in.name == 'Connection.Start':
            self.server_properties = frame_in.server_properties
            self._send_start_ok(frame_in)
        elif frame_in.name == 'Connection.Tune':
            self._send_tune_ok(frame_in)
            self._send_open_connection()
        else:
            LOGGER.error('[Channel0] Unhandled Frame: %s', frame_in.name)
15525
def show_qos_queue(self, queue, **_params):
        """"""
        return self.get(self.qos_queue_path % (queue),
                        params=_params)
531726
def _publish_confirm(self, frames_out):
        
        confirm_uuid = self._channel.rpc.register_request(['Basic.Ack',
                                                           'Basic.Nack'])
        self._channel.write_frames(frames_out)
        result = self._channel.rpc.get_request(confirm_uuid, raw=True)
        self._channel.check_for_errors()
        if isinstance(result, specification.Basic.Ack):
            return True
        return False
697321
async def do_api_call(self):
        """"""
        self.pyvlx.connection.register_frame_received_cb(
            self.response_rec_callback)
        await self.send_frame()
        await self.start_timeout()
        await self.response_received_or_timeout.wait()
        await self.stop_timeout()
        self.pyvlx.connection.unregister_frame_received_cb(self.response_rec_callback)
1060984
def setup_resume(self):
        
        self.frame_calling = None
        self.frame_stop = None
        self.frame_return = None
        self.frame_suspend = False
        self.pending_stop = False
        if not IKBreakpoint.any_active_breakpoint:
            self.disable_tracing()
        return