def init_queue_for(
            self,
            queue_identifier: QueueIdentifier,
            items: List[QueueItem_T],
    ) -> NotifyingQueue:
        """ Create the queue identified by the queue_identifier
        and initialize it with `items`.
        """
        recipient = queue_identifier.recipient
        queue = self.queueids_to_queues.get(queue_identifier)
        assert queue is None

        queue = NotifyingQueue(items=items)
        self.queueids_to_queues[queue_identifier] = queue

        events = self.get_health_events(recipient)

        greenlet_queue = gevent.spawn(
            single_queue_send,
            self,
            recipient,
            queue,
            queue_identifier,
            self.event_stop,
            events.event_healthy,
            events.event_unhealthy,
            self.retries_before_backoff,
            self.retry_interval,
            self.retry_interval * 10,
        )

        if queue_identifier.channel_identifier == CHANNEL_IDENTIFIER_GLOBAL_QUEUE:
            greenlet_queue.name = f'Queue for {pex(recipient)} - global'
        else:
            greenlet_queue.name = (
                f'Queue for {pex(recipient)} - {queue_identifier.channel_identifier}'
            )

        greenlet_queue.link_exception(self.on_error)
        self.greenlets.append(greenlet_queue)

        self.log.debug(
            'new queue created for',
            queue_identifier=queue_identifier,
            items_qty=len(items),
        )

        return queue
def init_queue_for ( self , queue_identifier : QueueIdentifier , items : List [ QueueItem_T ] , ) -> NotifyingQueue : recipient = queue_identifier . recipient queue = self . queueids_to_queues . get ( queue_identifier ) assert queue is None queue = NotifyingQueue ( items = items ) self . queueids_to_queues [ queue_identifier ] = queue events = self . get_health_events ( recipient ) greenlet_queue = gevent . spawn ( single_queue_send , self , recipient , queue , queue_identifier , self . event_stop , events . event_healthy , events . event_unhealthy , self . retries_before_backoff , self . retry_interval , self . retry_interval * 10 , ) if queue_identifier . channel_identifier == CHANNEL_IDENTIFIER_GLOBAL_QUEUE : greenlet_queue . name = f'Queue for {pex(recipient)} - global' else : greenlet_queue . name = ( f'Queue for {pex(recipient)} - {queue_identifier.channel_identifier}' ) greenlet_queue . link_exception ( self . on_error ) self . greenlets . append ( greenlet_queue ) self . log . debug ( 'new queue created for' , queue_identifier = queue_identifier , items_qty = len ( items ) , ) return queue
Create the queue identified by the queue_identifier
        and initialize it with `items`.