Gets msgs from the storage (if needed) and processes them one by one.
963668
def process_msgs

      @msgs = @storage.get_msgs if @msgs.empty?

      collisions = 0

      while @msg = @msgs.shift

        r = process(@msg)

        if r != false
          @processed_msgs += 1
        else
          collisions += 1
        end

        if collisions > 2
          @msgs = @msgs[(@msgs.size / 2)..-1] || []
          collisions = 0
        end

        break if Time.now.utc - @last_time >= 0.8
      end
    end
1313953
async def service_messages(self, msg, _context):
        """"""

        msgs = self.service_manager.service_messages(msg.get('name'))
        return [x.to_dict() for x in msgs]
951030
def decode(self, msg):
        """"""
        _check_message_valid(msg)
        cmd = msg[2:4]
        decoder = getattr(self, '_{}_decode'.format(cmd.lower()), None)
        if not decoder:
            cmd = 'unknown'
            decoder = self._unknown_decode
        decoded_msg = decoder(msg)
        for handler in self._handlers.get(cmd, []):
            handler(**decoded_msg)
522350
def get_message(message, *args, **kwargs):
        """"""
        msg = current_app.extensions['simplelogin'].messages.get(message)
        if msg and (args or kwargs):
            return msg.format(*args, **kwargs)
        return msg
1054334
def ProcessMessages(self, msgs=None, token=None):
    """"""
    if not data_store.AFF4Enabled():
      return

    filestore_fd = aff4.FACTORY.Create(
        legacy_filestore.FileStore.PATH,
        legacy_filestore.FileStore,
        mode="w",
        token=token)

    for vfs_urn in msgs:
      with aff4.FACTORY.Open(vfs_urn, mode="rw", token=token) as vfs_fd:
        try:
          filestore_fd.AddFile(vfs_fd)
        except Exception as e:  # pylint: disable=broad-except
          logging.exception("Exception while adding file to filestore: %s", e)
9985
def get_texts(self):
        
        with self.getstream() as text_stream:
            for i, line in enumerate(text_stream):
                line = SMSCorpus.case_normalizer(line)
                if self.mask is not None and not self.mask[i]:
                    continue
                ngrams = []
                for ng in tokens2ngrams(self.tokenizer(line)):
                    if SMSCorpus.ignore_matcher(ng):
                        continue
                    ngrams += [ng]
                yield ngrams
104982
def parse(cls, msg):
        """"""
        lines = msg.splitlines()
        method, uri, version = lines[0].split()
        headers = cls.parse_headers('\r\n'.join(lines[1:]))
        return cls(version=version, uri=uri, method=method, headers=headers)
247783
static SIMessageHandle[] getMessageHandles(final List messages) {

        final SIMessageHandle[] messageHandles = new SIMessageHandle[messages
                        .size()];
        for (int i = 0; i < messageHandles.length; i++) {
            final SIBusMessage message = (SIBusMessage) messages.get(i);
            messageHandles[i] = message.getMessageHandle();
        }
        return messageHandles;

    }
200362
def array_from_text(self, msg):
        """"""
        rows, columns = self.t.height, self.t.width
        return self.array_from_text_rc(msg, rows, columns)
870164
def next(self):
        
        if not self._messages:
            if self.auto_delete:
                self.delete_messages()
            raise StopIteration

        message = self._messages.pop(0)
        self._processed_messages.append(message)
        return json.loads(message.payload)
428076
def _process_message(self, msg):
        
        self._logger.info(
            'Processing Message(topic={}, partition={}, offset={}) ...'
            .format(msg.topic, msg.partition, msg.offset))
        try:
            job = self._deserializer(msg.value)
            job_repr = get_call_repr(job.func, *job.args, **job.kwargs)

        except Exception as err:
            self._logger.exception('Job was invalid: {}'.format(err))
            self._execute_callback('invalid', msg, None, None, None, None)
        else:
            self._logger.info('Executing job {}: {}'.format(job.id, job_repr))

            if job.timeout:
                timer = threading.Timer(job.timeout, _thread.interrupt_main)
                timer.start()
            else:
                timer = None
            try:
                res = job.func(*job.args, **job.kwargs)
            except KeyboardInterrupt:
                self._logger.error(
                    'Job {} timed out or was interrupted'.format(job.id))
                self._execute_callback('timeout', msg, job, None, None, None)
            except Exception as err:
                self._logger.exception(
                    'Job {} raised an exception:'.format(job.id))
                tb = traceback.format_exc()
                self._execute_callback('failure', msg, job, None, err, tb)
            else:
                self._logger.info('Job {} returned: {}'.format(job.id, res))
                self._execute_callback('success', msg, job, res, None, None)
            finally:
                if timer is not None:
                    timer.cancel()
173714
public void processThisMessage()
    {
        Utility.getLogger().info("On message called in receiving process");
        try {
            BaseMessage messageIn = this.getMessage();
            if (messageIn != null)
            {
                BaseMessage messageReply = this.createReplyMessage(messageIn);
                this.moveScreenParamsToMessage(messageReply);
                // Step 2 - Get the body part of the message
                this.getTransport().setupReplyMessage(messageReply, messageIn, MessageInfoTypeModel.REPLY, MessageTypeModel.MESSAGE_IN);
            
                this.getTransport().processIncomingMessage(messageReply, null);
            }
        } catch(Exception ex) {
            ex.printStackTrace();
            Debug.print(ex, "Error in processing or replying to a message");
        }
    }
1138427
public synchronized ServerStatusMessage[] getMessages(ServerStatusMessage afterMessage)
            throws Exception {

        boolean sawAfterMessage;
        String afterMessageString = null;
        if (afterMessage == null) {
            sawAfterMessage = true;
        } else {
            sawAfterMessage = false;
            afterMessageString = afterMessage.toString();
        }

        FileInputStream in = null;
        try {

            in = new FileInputStream(_file);

            BufferedReader reader =
                    new BufferedReader(new InputStreamReader(in));

            List<ServerStatusMessage> messages =
                    new ArrayList<ServerStatusMessage>();
            ServerStatusMessage message = getNextMessage(reader);
            while (message != null) {
                if (!sawAfterMessage) {
                    if (message.toString().equals(afterMessageString)) {
                        sawAfterMessage = true;
                    }
                } else {
                    messages.add(message);
                }
                message = getNextMessage(reader);
            }

            return messages.toArray(STATUS_MSG_ARRAY_TYPE);

        } catch (IOException ioe) {
            throw new Exception("Error opening server status file for reading: "
                                        + _file.getPath(),
                                ioe);
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (Exception e) {
                }
            }
        }
    }
482778
public void processError(String msg) {
        synchronized (frameListeners) {
            Iterator<FrameListener> it = frameListeners.iterator();
            while (it.hasNext()) {
                FrameListener listener = it.next();
                listener.processError(msg);
            }
        }
    }
365556
def process_message(self,msg,sock):
    ""
    command=msg[0]
    try: f={'GET':self.get,'SET':self.set,'SUBSCRIBE':self.sub,'PUBLISH':self.pub,
      'PING':self.ping,'GETSET':self.getset,'EXPIRE':self.expire,'DEL':self.delete}[command]
    except KeyError: print msg; raise
    args=msg[1:]
    try: return f(sock,*args) if command in self.SOCK_COMMANDS else f(*args)
    except Exception as e:
      print e
      print msg
      return '-ERROR\r\n'
131241
def recv_msg(self):
        ''''''
        if self._index >= self._count:
            return None
        m = self._msgs[self._index]
        self._index += 1
        self.percent = (100.0 * self._index) / self._count
        self.messages[m.get_type()] = m
        return m
61652
private void distribute(Msg msg)
    {
        //  If there are no matching pipes available, simply drop the message.
        if (matching == 0) {
            return;
        }

        // TODO isVsm

        //  Push copy of the message to each matching pipe.
        for (int idx = 0; idx < matching; ++idx) {
            if (!write(pipes.get(idx), msg)) {
                --idx; //  Retry last write because index will have been swapped
            }
        }
    }