Set up dispatch action
423442
function start(payload) {
  for (var id in this.callbacks) {
    this.isPending[id] = false;
    this.isHandled[id] = false;
  }
  this.isDispatching = true;
  this.pendingPayload = payload;
}
487866
def dispatch_request(self, environ, start_response):
        """"""
        # set up all the stuff we want to have for this request.  That is
        # creating a request object, propagating the application to the
        # current context and instanciating the database session.
        self.bind_to_context()
        request = Request(environ)
        request.bind_to_context()

        # get the current action from the url and normalize the page name
        # which is just the request path
        action_name = request.args.get("action") or "show"
        page_name = u"_".join([x for x in request.path.strip("/").split() if x])

        # redirect to the Main_Page if the user requested the index
        if not page_name:
            response = redirect(href("Main_Page"))

        # check special pages
        elif page_name.startswith("Special:"):
            if page_name[8:] not in pages:
                response = page_not_found(request, page_name)
            else:
                response = pages[page_name[8:]](request)

        # get the callback function for the requested action from the
        # action module.  It's "on_" + the action name.  If it doesn't
        # exists call the missing_action method from the same module.
        else:
            action = getattr(actions, "on_" + action_name, None)
            if action is None:
                response = actions.missing_action(request, action_name)
            else:
                response = action(request, page_name)

        # make sure the session is removed properly
        return ClosingIterator(response(environ, start_response), session.remove)
569695
def _update_dispatches(self):
        """"""
        Dispatch.log_dispatches_errors(self._st['error'] + self._st['failed'])
        Dispatch.set_dispatches_statuses(**self._st)
        self._init_delivery_statuses_dict()
1373616
def dispatch(self, action, event, compute_id):
        
        if action == "node.updated":
            try:
                # Update controller node data and send the event node.updated
                project = self._controller.get_project(event["project_id"])
                node = project.get_node(event["node_id"])
                yield from node.parse_node_response(event)

                self.emit("node.updated", node.__json__())
            except (aiohttp.web.HTTPNotFound, aiohttp.web.HTTPForbidden):  # Project closing
                return
        elif action == "ping":
            event["compute_id"] = compute_id
            self.emit(action, event)
        else:
            self.emit(action, event)
541278
function trigger (dispatcher) {
  var queue = dispatcher.undispatchedEventsQueue || []
  var event;

  // if the last loop is still in progress leave this loop
  if (dispatcher.isRunning) return;

  dispatcher.isRunning = true;

  (function next (e) {

    // dipatch one event in queue and call the _next_ callback, which
    // will call _process_ for the next undispatched event in queue.
    function process (event, nxt) {

      // Publish it now...
      debug('publish event...');
      dispatcher.publisher(event.payload, function(err) {
        if (err) {
          return debug(err);
        }
        // ...and set the published event to dispatched.
        debug('set event to dispatched...');
        dispatcher.store.setEventToDispatched(event, function(err) {
          if (err) {
            debug(err);
          } else {
            debug('event set to dispatched');
          }
        });
      });

      nxt();
    }

    // serial process all events in queue
    if (!e && queue.length) {
      process(queue.shift(), next)
    } else {
      debug(e);
    }
  })();

  dispatcher.isRunning = false;
}
376449
function configureEvents(dispatch, options){
                        if (dispatch && options){
                            angular.forEach(dispatch, function(value, key){
                                if (options[key] === undefined || options[key] === null){
                                    if (scope._config.extended) options[key] = value.on;
                                }
                                else dispatch.on(key + '._', options[key]);
                            });
                        }
                    }
455839
function dispatch(req, done) {
      var site = req.site
        , path = upath.join(site.path || '', req.path)
        , parent = site.parent;
      while (parent) {
        path = upath.join(parent.path || '', path);
        parent = parent.parent;
      }
      
      console.log('# ' + path);
      
      var page = new Page(path, req.context);
      pages.push(page);
      
      page.once('close', done);
      //page.site = self;
      //page.pages = pages;
      self.handle(page);
    }
1279535
def do_dispatch(env)
      path = env['PATH_INFO']

      # Try to serve a public file
      ret = dispatch_public(env, path)
      return ret if not ret.nil?

      log.debug "Checking for routes that match: #{path}"
      route = router.match(env)

      if route.has_key? :ok
        dispatch_controller(route, env)
      else
        [404, {"Content-Type" => "text/plain"}, ["404 Not Found: #{path}"]]
      end
    end
1306117
def dispatch_command(self, command, params=None):
        """"""
        try:
            if command in self.handlers:
                self.handlers[command](**params)
            else:
                logging.warning('Unsupported command: %s: %s',
                                command, params)
        except Exception as e:
            logging.warning('Error during command execution',
                            exc_info=sys.exc_info())
            raise e
135549
async def trigger(self, action, args):
        
        handler_name = f"on_{action}"
        handler = getattr(self, handler_name, None)
        if not handler:
            return None
        await handler(*args)
529757
def action_dispatch_params
      action_dispatch_params = env['action_dispatch.request.path_parameters'] || {}
      action_dispatch_params.inject({}) {|hash, (key, value)| hash[key.to_s] = value; hash }
    end
435464
public function dispatch()
    {
        $request  = Container::getRequest();
        $response = Container::getResponse();
        
        PluginManager::handleApplicationPlugins(PluginManager::STEP_BEFORE_DISPATCH_LOOP);
        //self::debug('Begin dispatch loop...');
        while (!$this->dispatched) {
            
            try {
                PluginManager::handleApplicationPlugins(PluginManager::STEP_BEFORE_ACTION);
                //self::debug('Begin dispatch ' . $request->getController() . '::' . $request->getAction() . ' [' . json_encode($request->getParams()) . ']');
                $this->dispatchProcess($request, $response);
                //self::debug('End dispatch ' . $request->getController() . '::' . $request->getAction() . ' [' . json_encode($request->getParams()) . ']');
                PluginManager::handleApplicationPlugins(PluginManager::STEP_AFTER_ACTION);
            }
            catch (Exception $e) {
                if ($request->getController(false) == 'event' 
                 && $request->getAction(false) == 'error') {
                    throw $e;
                }
                Container::getView()->addValue('exception', $e);
                $this->renderView = true;
                $request->setController('event')->setAction('error');
                $this->setDispatched(false);
            }
        }
        PluginManager::handleApplicationPlugins(PluginManager::STEP_AFTER_DISPATCH_LOOP);
        self::debug('End dispatch loop');
        if ($this->dispatched && $this->renderLayout) {
            $layout = Container::getConfig()->getConfig('layout');
            if ($layout !== null) {
                if (!file_exists($layout)) {
                    throw new ArchException('Layout file ' . $layout . ' not found');
                }
                $response->setBody(Container::getLayout(true)->render($layout));
            }
        }
        if ($this->renderResponse) {
            $response->fixHeaders()->putTypeHeadersInResponse();
            foreach ($response->getHeaders() as $header) {
                header($header);
            }
            $response->executeCallback();
            if ($response->hasBody()) {
                echo $response->getBody();
            }
        }
        return $this;
    }
710389
def dispatch_hook(key, hooks, hook_data, **kwargs):
    """"""
    hooks = hooks or {}
    hooks = hooks.get(key)
    if hooks:
        if hasattr(hooks, '__call__'):
            hooks = [hooks]
        for hook in hooks:
            _hook_data = hook(hook_data, **kwargs)
            if _hook_data is not None:
                hook_data = _hook_data
    return hook_data
786882
public function dispatchTo($action)
    {
        $this->setAction($action);

        $this->hook->action(
            'init',
            [$this, 'hooks']
        )->dispatch();

        return $this;
    }
1103612
def _setup_rest_dispatcher(self):
        
        for _, method in inspect.getmembers(self, inspect.isroutine):
            try:
                config = getattr(method, HTTP_ROUTE_ATTRIBUTE)
            except AttributeError:
                # Not a REST method
                continue

            for route in config["routes"]:
                pattern, arguments = self.__convert_route(route)
                self.__methods_args.setdefault(method, {}).update(arguments)
                for http_verb in config["methods"]:
                    self.__routes.setdefault(http_verb, {})[pattern] = method
1033830
def dispatch(self):
    """"""
    try:
      webapp2.RequestHandler.dispatch(self)
    finally:
      self.session_store.save_sessions(self.response)
747084
function (dispatcher) {

    if (dispatchers.isDispatcher(dispatcher)) {
      this.dispatcher = dispatcher;
    } else {
      this.dispatcher = new dispatchers.Dispatcher();
    }

    var action = this;
    var prototype = Object.getPrototypeOf(this);
    Object.keys(prototype).forEach(function (method) {
      if (method !== 'dispatch') {
        action[method] = function () {
          var ret = prototype[method].apply(action, arguments);
          if (typeof ret !== 'undefined') {
            action.dispatch(ret);
          }
        };
      }
    });
  }