This action puts a message in the global queue that all the clients
        will get via the 'pull' action.
506077
def push(self):
        """"""
        print `request.body`
        yield request.environ['cogen.call'](pubsub.publish)(
            "%s: %s" % (session['client'].name, request.body)
        )
        # the request.environ['cogen.*'] objects are the the asynchronous
        # make the code here work as a coroutine and still work with any
        # wsgi extensions offered by cogen - basicaly they do some magic to
        # middleware
        yield str(request.environ['cogen.wsgi'].result)
630695
def _got_message(self, uid, text):
        
        #TODO: use try
        e = Event(uid, E_MESSAGE, text)
        self.queue.put_nowait(e)

        self.controllers[uid][2] = time.time()
912560
def _deliver_message(self, msg):
        
        my_subscribed_actions = self.subscriptions.get(msg.sender, [])
        for action in my_subscribed_actions:
            if Global.CONFIG_MANAGER.tracing_mode:
                Global.LOGGER.debug(f"delivering message to {action.name}")
            action.on_input_received(msg)
1324729
protected void putToQueue(IQueueMessage<ID, DATA> msg) throws QueueException.QueueIsFull {
        if (!queue.offer(msg)) {
            throw new QueueException.QueueIsFull(getBoundary());
        }
    }
36192
def dispatch(message, channel)
      push(Oj.dump(message, mode: :compat)) unless channel =~ /\Aslanger:/

      perform_client_webhook!(message)
    end
1202252
protected void notifyAllPendingSenders(String message) {
        for (ChannelFuture future : _futureMap.values()) {
            future.setFailure(new Error(message));
        }
    }
223568
def handle_message(self, message):
        
        try:
            if "eta" in message.options:
                self.logger.debug("Pushing message %r onto delay queue.", message.message_id)
                self.broker.emit_before("delay_message", message)
                self.delay_queue.put((message.options.get("eta", 0), message))

            else:
                actor = self.broker.get_actor(message.actor_name)
                self.logger.debug("Pushing message %r onto work queue.", message.message_id)
                self.work_queue.put((actor.priority, message))
        except ActorNotFound:
            self.logger.error(
                "Received message for undefined actor %r. Moving it to the DLQ.",
                message.actor_name, exc_info=True,
            )
            message.fail()
            self.post_process_message(message)
170834
private void doQueueElement(final Message<JsonObject> message) {
    final String name = message.body().getString("name");
    if (name == null) {
      message.reply(new JsonObject().putString("status", "error").putString("message", "No name specified."));
      return;
    }

    context.execute(new Action<Object>() {
      @Override
      public Object perform() {
        return data.getQueue(formatKey(name)).element();
      }
    }, new Handler<AsyncResult<Object>>() {
      @Override
      public void handle(AsyncResult<Object> result) {
        if (result.failed()) {
          message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
        } else {
          message.reply(new JsonObject().putString("status", "ok").putValue("result", result.result()));
        }
      }
    });
  }
1031942
def HandleMessage(self, message):
    
    self._is_active = True
    try:
      action_cls = actions.ActionPlugin.classes.get(message.name)
      if action_cls is None:
        raise RuntimeError("Client action %r not known" % message.name)

      action = action_cls(grr_worker=self)

      # Write the message to the transaction log.
      self.transaction_log.Write(message)

      # Heartbeat so we have the full period to work on this message.
      action.Progress()
      action.Execute(message)

      # If we get here without exception, we can remove the transaction.
      self.transaction_log.Clear()
    finally:
      self._is_active = False
      # We want to send ClientStats when client action is complete.
      self.stats_collector.RequestSend()
237650
def _publish_deferred_messages(self):
        
        global message_stack
        if not self._rabbitmq_is_closed and message_stack:
            LOGGER.info('Publishing %i deferred message(s)', len(message_stack))
            while message_stack:
                self._publish_message(*message_stack.pop())
296785
def broadcast(cls, message):
        
        clients = cls.get_clients()
        # loop over every client and send message
        for id, client in clients.iteritems():
            client.send_message(message)
706703
def launch_all
      @servers.each { |s|
        begin
          object_behavior(s, :start)
        rescue Exception => e
          raise e unless e.message =~ /AlreadyLaunchedError/
        end
      }
    end
180468
final PullResponse pull(
      String subscription, boolean returnImmediately, int maxMessages) {

    PullRequest request =
        PullRequest.newBuilder()
            .setSubscription(subscription)
            .setReturnImmediately(returnImmediately)
            .setMaxMessages(maxMessages)
            .build();
    return pull(request);
  }
748946
def run(self):
        '''
        
        '''
        global _global_kill

        for message in self._messages:

            # Get the message contents from the batch file
            batch_file = self._getBatchFile(message)
            message_contents = batch_file.getMessage(message)
            self._logger.debug(
                'Read message {:}, waiting to be put into queue'
                .format(message))

            # Then repeatedly try to put the contents into the queue,
            # occasionally timing out so that we might catch the kill signal
            put_succeeded = False
            while not put_succeeded:

                if _global_kill.isSet():
                    return

                try:
                    self._queue.put(message_contents, block=True, timeout=1.0)
                except Full:
                    pass
                else:
                    put_succeeded = True
                    self._logger.debug('Message put into queue')
1045187
def _push_actions(self):
        
        data = cherrypy.request.json
        with self.app.lock:
            self.app.add_actions(data['actions'], data['scheduler_instance_id'])
203323
def push(self,message,message_type):
        
            
        super(Producer,self).send(message,message_type)
301377
private function triggerQueueNow()
    {
        $url = UrlHelper::actionUrl('queue/run');

        if (\function_exists('curl_init')) {
            $ch = curl_init($url);

            $options = [
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_CONNECTTIMEOUT => false,
                CURLOPT_NOSIGNAL => true
            ];

            if (\defined('CURLOPT_TIMEOUT_MS')) {
                $options[CURLOPT_TIMEOUT_MS] = 500;
            } else {
                $options[CURLOPT_TIMEOUT] = 1;
            }

            curl_setopt_array($ch, $options);
            curl_exec($ch);
            curl_close($ch);
        }
    }