Connect to queue_name, post a durable message with body, disconnect from queue_name.
        :param queue_name: str: name of the queue we want to put a message on
        :param body: content of the message we want to send
358818
def send_durable_message(self, queue_name, body):
        
        self.connect()
        channel = self.create_channel(queue_name)
        channel.basic_publish(exchange='',
                              routing_key=queue_name,
                              body=body,
                              properties=pika.BasicProperties(
                                 delivery_mode=2,  # make message persistent
                              ))
        self.close()
334310
def enqueue(self, queue_identifier: QueueIdentifier, message: Message):
        
        assert queue_identifier.recipient == self.receiver
        with self._lock:
            already_queued = any(
                queue_identifier == data.queue_identifier and message == data.message
                for data in self._message_queue
            )
            if already_queued:
                self.log.warning(
                    'Message already in queue - ignoring',
                    receiver=pex(self.receiver),
                    queue=queue_identifier,
                    message=message,
                )
                return
            timeout_generator = udp_utils.timeout_exponential_backoff(
                self.transport._config['retries_before_backoff'],
                self.transport._config['retry_interval'],
                self.transport._config['retry_interval'] * 10,
            )
            expiration_generator = self._expiration_generator(timeout_generator)
            self._message_queue.append(_RetryQueue._MessageData(
                queue_identifier=queue_identifier,
                message=message,
                text=json.dumps(message.to_dict()),
                expiration_generator=expiration_generator,
            ))
        self.notify()
25599
def send(self, data):
        
        if not self._connected:
            raise ConnectionError('Not connected')

        return self._send_queue.put(data)
329115
def register(self):
        
        self._queue.put(hello_packet(socket.gethostname(), mac(), __version__))
        self._queue.put(request_packet(MSG_SERVER_SETTINGS))
        self._queue.put(request_packet(MSG_SAMPLE_FORMAT))
        self._queue.put(request_packet(MSG_HEADER))
261545
def send(self, message):
        
        self.logger.debug('Send message: {}'.format(message))

        if self.state == 'pending' or self.state == 'connection_pending':
            self.logger.info('Connection not established. Add message to queue.')
            self.message_queue.append(message)
            return
        elif self.state == 'unsubscribed' or self.state == 'rejected':
            self.logger.warning('Not subscribed! Message discarded.')
            return

        data = {
            'command': 'message',
            'identifier': self._identifier_string(),
            'data': message.raw_message()
        }

        self.connection.send(data)
771382
def queue(self, queue, message, params={}, uids=[]):
        

        d = {
            'id': uuid.uuid1().get_hex(),
            'version': 1,
            'message': message,
            'params': params
        }

        ser = json.dumps(d)
        
        if uids:
            for uid in uids:
                path = '/dq/%s/%s' % (uid, queue)
                yield self._put_queue(path, ser)

        else:
            path = '/q/%s' % queue
            yield self._put_queue(path, ser)

        defer.returnValue(d['id'])
894142
def receive_loop_with_callback(self, queue_name, callback):
        
        self.connect()
        channel = self.create_channel(queue_name)
        channel.basic_qos(prefetch_count=1)
        channel.basic_consume(callback, queue=queue_name)
        channel.start_consuming()
416458
def create_queue(name, attributes = {})
      response = action("CreateQueue", {"QueueName" => Queue.sanitize_name("#{queue_prefix}#{name}")}.merge(attributes))

      if response.success?
        Queue.new(self, response.doc.xpath("//QueueUrl").text)
      else
        raise "Could not create queue #{name}"
      end

    rescue AwsActionError => error
      if error.code == "AWS.SimpleQueueService.QueueDeletedRecently"
        raise QueueDeletedRecentlyError, error.message
      else
        raise error
      end
    end
872011
def get_queue(name, options = {})
      response = action("GetQueueUrl", {"QueueName" => Queue.sanitize_name("#{queue_prefix}#{name}")}.merge(options))
      
      if response.success?
        Queue.new(self, response.doc.xpath("//QueueUrl").text)
      end

    rescue Bisques::AwsActionError => e
      raise unless e.code == "AWS.SimpleQueueService.NonExistentQueue"
    end
326134
public static String pingJmsEndpoint(MuleContext muleContext, String queueName) {
		return pingJmsEndpoint(muleContext, DEFAULT_MULE_JMS_CONNECTOR, queueName);
	}
1046684
async def queue_declare(self):
         
        await self.channel.queue_declare(
                self.queue,
                durable=self.durable,
                exclusive=self.exclusive,
                no_wait=self.no_wait
            )
568088
def body(self):
        
        self.connection = pika.BlockingConnection(self.connection_param)
        self.channel = self.connection.channel()

        # receive messages and put them to .onMessageReceived() callback
        for method_frame, properties, body in self.channel.consume(self.queue):
            if self.onMessageReceived(method_frame, properties, body):
                self.ack(method_frame.delivery_tag)
227906
def flush(self, queue_name):
        
        for name in (queue_name, dq_name(queue_name)):
            self.do_purge(name)
265140
public void sendTextMessage(String queueName, String message, int delaySeconds)
            throws NamingException, JMSException, ServiceLocatorException {
        sendTextMessage(null, queueName, message, delaySeconds, null);
    }
376390
def send_message(self, msg, connection_id=None):
        
        zmq_identity = None
        if connection_id is not None and self._connections is not None:
            if connection_id in self._connections:
                connection_info = self._connections.get(connection_id)
                if connection_info.connection_type == \
                        ConnectionType.ZMQ_IDENTITY:
                    zmq_identity = connection_info.connection
            else:
                LOGGER.debug("Can't send to %s, not in self._connections",
                             connection_id)

        self._ready.wait()

        if zmq_identity is None:
            message_bundle = [msg.SerializeToString()]
        else:
            message_bundle = [bytes(zmq_identity),
                              msg.SerializeToString()]

        try:
            asyncio.run_coroutine_threadsafe(
                self._send_message_frame(message_bundle),
                self._event_loop)
        except RuntimeError:
            # run_coroutine_threadsafe will throw a RuntimeError if
            # the eventloop is closed. This occurs on shutdown.
            pass
82528
def drop_all(self, queue_name):
        
        task_ids = self.conn.lrange(queue_name, 0, -1)

        for task_id in task_ids:
            self.conn.delete(task_id)

        self.conn.delete(queue_name)
941308
def _get_queue_name(cls, queue_name=None):
        
        if queue_name is None and cls.queue_name is None:
            raise LimpydJobsException("Queue's name not defined")
        if queue_name is None:
            return cls.queue_name
        return queue_name