Process an array of OperationMessages.
425481
private void processReturnOperations(final ResponseMessage response) {
    final List<OperationMessage> ops = response.getOperations();

    // If there are no observable effects, this will be null
    if (ops == null) {
      return;
    }

    for (final OperationMessage op : ops) {
      final SimpleProxyId<?> id = this.getId(op);
      WriteOperation[] toPropagate = null;

      // May be null if the server is returning an unpersisted object
      final WriteOperation effect = op.getOperation();
      if (effect != null) {
        switch (effect) {
          case DELETE:
            toPropagate = DELETE_ONLY;
            break;
          case PERSIST:
            toPropagate = PERSIST_AND_UPDATE;
            break;
          case UPDATE:
            toPropagate = UPDATE_ONLY;
            break;
          default:
            // Should never reach here
            throw new RuntimeException(effect.toString());
        }
      }
      this.processReturnOperation(id, op, toPropagate);
    }

    assert this.state.returnedProxies.size() == ops.size();
  }
182188
def run(self):
        """"""
        for msg in self.messages:
            col = getattr(msg, 'col', 0)
            yield msg.lineno, col, (msg.tpl % msg.message_args), msg.__class__
558579
@Override
    public void handleMessage(Message message) throws Fault {

        //ignore the messages from SAM Server service itself
        BindingOperationInfo boi = message.getExchange().getBindingOperationInfo();
        if (null != boi){
            String operationName = boi.getName().toString();
            if (SAM_OPERATION.equals(operationName)) {
                return;
            }
        }

        if (isRestWadlRequest(message)) {
            // skip handling REST service WADL requests - temporary fix since will be fixed in CXF soon
            return;
        }

        if (isOnewayResponse(message)) {
            // skip oneway response events
            return;
        }

        // Skip Swagger UI web static, swagger.json and swagger.yaml requests
        if (isSwaggerResourceRequest(message)) {
            return;
        }

        //check MessageID
        checkMessageID(message);

        Event event = mapper.mapToEvent(message);

        if (LOG.isLoggable(Level.FINE)) {
            String id = (event.getMessageInfo() != null) ? event.getMessageInfo().getMessageId() : null;
            LOG.fine("Store event [message_id=" + id + "] in cache.");
        }
        if (null != event) {
            queue.add(event);
        }

        // TESB-20624 skip duplicated event processing
        message.getInterceptorChain().remove(this);
    }
520108
function onMessage(message) {
  if (message.command === 'run') {
    run(message.opts);
    return;
  }

  if (message.command === 'stop') {
    cleanup();
  }
}
1220592
@Override
    public void processMessage(AbsSender absSender, Message message, String[] arguments) {
        execute(absSender, message.getFrom(), message.getChat(), message.getMessageId(), arguments);
    }
42930
public void perform() {
        for (int i = 0; i < operations.size(); i++) {
            operations.get(i).process();
        }
    }
1300
def get_callbacks_from_message(self, msg):
        """"""
        callbacks = []
        for key in self._find_matching_keys(msg):
            for callback in self[key]:
                callbacks.append(callback)
        return callbacks
580070
private void doBatchMessage(final JsonObject message) {
    String batchID = message.getString("batch");
    if (currentBatch != null && currentBatch.id().equals(batchID)) {
      Object value = deserializer.deserialize(message);
      if (value != null) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("%s - Batch received: Batch[batch=%s, id=%d, message=%s]", this, batchID, message.getLong("id"), value));
        }
        currentBatch.handleMessage(value);
      }
    }
  }
645898
async def _do(self, ctx, times: int, *, command):
        """"""
        msg = copy.copy(ctx.message)
        msg.content = command
        for i in range(times):
            await self.bot.process_commands(msg)
404369
def _process_message(self, message: amqp.Message) -> None:
        """"""
        if self.shutdown_pending.is_set():
            return

        try:
            if isinstance(message.body, bytes):
                message.body = message.body.decode()
            description = json.loads(message.body)
        except Exception:
            logger.error("Cannot decode message. Dropping. Message: %r", message.body)
            traceback.print_exc()
            message.channel.basic_reject(message.delivery_tag, requeue=False)
        else:
            logger.info("Processing task: %r", description)
            self._process_description(message, description)
531118
def from_array(messages, save_cache=false)
      clear unless save_cache
      messages.each do |msg|
        add msg[0], msg[1]
      end
    end
1357889
def _do_batched_op_msg(
        namespace, operation, command, docs, check_keys, opts, ctx):
    
    command['$db'] = namespace.split('.', 1)[0]
    if 'writeConcern' in command:
        ack = bool(command['writeConcern'].get('w', 1))
    else:
        ack = True
    if ctx.sock_info.compression_context:
        return _batched_op_msg_compressed(
            operation, command, docs, check_keys, ack, opts, ctx)
    return _batched_op_msg(
        operation, command, docs, check_keys, ack, opts, ctx)
219446
def _process_inbox_message(self, message: praw.models.Message):
        
        self._func_message(message, *self._func_message_args)
1009130
def message_handlers(self):
        """"""
        index = lib.EnvGetNextDefmessageHandler(self._env, self._cls, 0)

        while index != 0:
            yield MessageHandler(self._env, self._cls, index)

            index = lib.EnvGetNextDefmessageHandler(self._env, self._cls, index)
292066
def process_events(args):
    """"""
    client = EventsClient.from_config()
    client.set_debug(True)
    if args.get:
        response = client.get_events()
    elif args.flush:
        response = client.flush_events()
    return response
429888
public function getMessages()
    {
        $results  = $this->getResults();
        $messages = [];

        foreach ($results as $result) {
            /** @noinspection SlowArrayOperationsInLoopInspection */
            $messages = array_replace_recursive($messages, $result->getMessages());
        }

        return $messages;
    }
698326
public void processEvents(String msgid, String textMessage) {
        try {
            if (logger.isDebugEnabled())
                logger.debug("executeFlow: " + textMessage);
            InternalEvent event = new InternalEvent(textMessage);
            // a. find the process instance (looking for memory only first, then regular)
            Long procInstId;
            ProcessInstance procInst;
            if (event.isProcess()) {
                if (event.getEventType().equals(EventType.FINISH)) {
                    procInstId = null;    // not needed, and for remote process returns, will not be able to find it
                } else {
                    procInstId = event.getWorkInstanceId();
                }
            } else {
                procInstId = event.getOwnerId();
            }
            if (procInstId != null) {
                EngineDataAccess temp_edao = EngineDataAccessCache.getInstance(false, 9);
                procInst = temp_edao.getProcessInstance(procInstId);
                if (procInst==null) {
                    TransactionWrapper transaction = null;
                    EngineDataAccessDB edbao = new EngineDataAccessDB();
                    try {
                        transaction = edbao.startTransaction();
                        procInst = edbao.getProcessInstance(procInstId);
                    }
                    catch (SQLException ex) {
                        if (("Failed to load process instance: " + procInstId).equals(ex.getMessage())) {
                            if (ApplicationContext.isDevelopment()) {
                                logger.severe("Unable to load process instance id=" + procInstId + ".  Was this instance deleted?");
                                return;
                            } else {
                                throw ex;
                            }
                        }
                    }
                    finally {
                        edbao.stopTransaction(transaction);
                    }
                }
            } else {
                procInst = null;
            }
            // b. now determine performance level here
            int performance_level;
            if (procInst == null) {        // must be process start message
                if (event.isProcess() && event.getEventType().equals(EventType.START)) {
                    Process procdef = getProcessDefinition(event.getWorkId());
                    performance_level = procdef.getPerformanceLevel();
                } else {
                    performance_level = 0;
                }
            } else {
                Process procdef = getProcessDefinition(procInst.getProcessId());
                if (procdef == null) {
                    String msg = "Unable to load process id " + procInst.getProcessId() + " (instance id=" + procInst.getId() + ") for " + msgid;
                    if (ApplicationContext.isDevelopment()) {
                        // referential integrity not always enforced for VCS assets
                        if (PropertyManager.getBooleanProperty(PropertyNames.MDW_INTERNAL_EVENT_DEV_CLEANUP, true)) {
                            logger.severe(msg + " (event will be deleted)");
                            EngineDataAccess edao = EngineDataAccessCache.getInstance(false, default_performance_level_regular);
                            InternalMessenger msgBroker = MessengerFactory.newInternalMessenger();
                            ProcessExecutor engine = new ProcessExecutor(edao, msgBroker, false);
                            engine.deleteInternalEvent(msgid);
                            return;
                        }
                        else {
                            logger.severe(msg);
                        }
                    }
                    else {
                        throw new WorkflowException(msg);
                    }
                }
                performance_level = procdef.getPerformanceLevel();
            }
            if (performance_level <= 0)
                performance_level = default_performance_level_regular;
            // c. create engine
            EngineDataAccess edao = EngineDataAccessCache.getInstance(false, performance_level);
            InternalMessenger msgBroker = MessengerFactory.newInternalMessenger();
            ProcessExecutor engine = new ProcessExecutor(edao, msgBroker, false);
            if (msgid != null) {
                boolean success = engine.deleteInternalEvent(msgid);
                if (!success) {
                    // retry two times to get around race condition (internal event inserted
                    // into EVENT_INSTANCE table but not committed yet)
                    int retries = 0;
                    while (!success && retries < 2) {
                        logger.debug("Failed to consume internal event " + msgid + " - retry in 2 seconds");
                        Thread.sleep(eventConsumeRetrySleep * 1000);
                        retries++;
                        success = engine.deleteInternalEvent(msgid);
                    }
                }
                if (!success) {
                    logger.warn("Fail to consume internal event " + msgid + " - assuming the event is already processed by another thread");
                    return;    // already processed;
                }
            }
            if (performance_level >= 9)
                msgBroker.setCacheOption(InternalMessenger.CACHE_ONLY);
            else if (performance_level >= 3)
                msgBroker.setCacheOption(InternalMessenger.CACHE_ON);
            // d. process event(s)
            if (performance_level >= 3) {
                // TODO cache proc inst
                processEvent(engine, event, procInst);
                while ((event = msgBroker.getNextMessageFromQueue(engine)) != null) {
                    procInst = this.findProcessInstance(engine, event);
                    processEvent(engine, event, procInst);
                }
            } else {
                processEvent(engine, event, procInst);
            }
        } catch (XmlException e) {
            logger.severeException("Unparsable xml message: " + textMessage, e);
        } catch (Throwable ex) {
            logger.severeException(ex.getMessage(), ex);
        }
    }