Configure the message route workflow
504856
public void configure() throws Exception {

        final Namespaces ns = new Namespaces("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
                .add("fedora", REPOSITORY);

        /**
         * A generic error handler (specific to this RouteBuilder)
         */
        onException(Exception.class)
                .maximumRedeliveries("{{error.maxRedeliveries}}")
                .log("Index Routing Error: ${routeId}");

        /**
         * Handle Serialization Events
         */
        from("{{input.stream}}")
            .routeId("FcrepoSerialization")
            .process(new EventProcessor())
            .process(exchange -> {
                final String uri = exchange.getIn().getHeader(FCREPO_URI, "", String.class);
                exchange.getIn().setHeader(SERIALIZATION_PATH, create(uri).getPath());
            })
            .filter(not(in(uriFilter)))
            .choice()
                .when(or(header(FCREPO_EVENT_TYPE).contains(RESOURCE_DELETION),
                            header(FCREPO_EVENT_TYPE).contains(DELETE)))
                    .to("direct:delete")
                .otherwise()
                    .multicast().to("direct:metadata", "direct:binary");

        from("{{serialization.stream}}")
            .routeId("FcrepoReSerialization")
            .filter(not(in(uriFilter)))
            .process(exchange -> {
                final String uri = exchange.getIn().getHeader(FCREPO_URI, "", String.class);
                exchange.getIn().setHeader(SERIALIZATION_PATH, create(uri).getPath());
            })
            .multicast().to("direct:metadata", "direct:binary");

        from("direct:metadata")
            .routeId("FcrepoSerializationMetadataUpdater")
            .to("fcrepo:localhost?accept={{serialization.mimeType}}")
            .log(INFO, LOGGER, "Serializing object ${headers[CamelFcrepoUri]}")
            .setHeader(FILE_NAME).simple("${headers[CamelSerializationPath]}.{{serialization.extension}}")
            .log(DEBUG, LOGGER, "filename is ${headers[CamelFileName]}")
            .to("file://{{serialization.descriptions}}");

        from("direct:binary")
            .routeId("FcrepoSerializationBinaryUpdater")
            .filter().simple("{{serialization.includeBinaries}} == 'true'")
            .to("fcrepo:localhost?preferInclude=PreferMinimalContainer" +
                    "&accept=application/rdf+xml")
            .filter().xpath(isBinaryResourceXPath, ns)
            .log(INFO, LOGGER, "Writing binary ${headers[CamelSerializationPath]}")
            .to("fcrepo:localhost?metadata=false")
            .setHeader(FILE_NAME).header(SERIALIZATION_PATH)
            .log(DEBUG, LOGGER, "header filename is: ${headers[CamelFileName]}")
            .to("file://{{serialization.binaries}}");

        from("direct:delete")
            .routeId("FcrepoSerializationDeleter")
            .setHeader(EXEC_COMMAND_ARGS).simple(
                "-rf {{serialization.descriptions}}${headers[CamelSerializationPath]}.{{serialization.extension}} " +
                "{{serialization.descriptions}}${headers[CamelSerializationPath]} " +
                "{{serialization.binaries}}${headers[CamelSerializationPath]}")
            .to("exec:rm");
    }
680011
protected void routeTo(String msg, LogRecord logRecord, String logHandlerId) {
        LogHandler logHandler = logHandlerServices.get(logHandlerId);
        if (logHandler != null) {
            logHandler.publish(msg, logRecord);
        }
    }
1338538
def assign_routes(self, app):
        """"""
        for grp in self.filters:
            for f in self.filters[grp]:
                if f.route_func:
                    f.register_route(app)

        for c in self.charts:
            if c.route_func:
                c.register_route(app)
1014185
def _decorate_routes(self):
        
        self.logger.debug("Decorating routes")
        # self.app.add_url_rule('/', 'catch', self.catch, methods=['GET'],
        #                        defaults={'path': ''})
        self.app.add_url_rule('/<path:path>', 'catch', self.catch,
                              methods=['GET', 'POST'], defaults={'path': ''})
        self.app.add_url_rule('/', 'index', self.index,
                              methods=['POST', 'GET'])
        self.app.add_url_rule('/feed', 'feed', self.feed,
                              methods=['POST'])
        self.app.add_url_rule('/poll', 'poll', self.poll,
                              methods=['POST'])
1191825
def _func_router(self, msg, fname, **config):
        
        FNAME = 'handle_%s_autocloud_%s'

        if ('compose_id' in msg['msg'] or 'compose_job_id' in msg['msg'] or
                'autocloud.compose' in msg['topic']):
            return getattr(self, FNAME % ('v2', fname))(msg, **config)
        else:
            return getattr(self, FNAME % ('v1', fname))(msg, **config)
528936
private void configureNeighbours() {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "configureNeighbours");

        try {
            JsAdminService service = JsMainAdminComponentImpl.getJsAdminService();

            // Check that the admin service is initialized before calling it.
            // Tell TRM the set of messaging engines on the bus
            _messagingEnginesOnBus = new HashSet<SIBUuid8>();
            // Add this messaging engine to the list.
            // messagingEnginesOnBus.add(getMessagingEngineUuid());

            Set mes = null;

            // Check that the admin service is initialized before calling it.
            if (service.isInitialized())
                mes = service.getMessagingEngineSet(_engine.getBusName());

            if (mes != null) {
                Iterator iterator = mes.iterator();

                // Create a transaction for creating the Neighbours with.
                LocalTransaction transaction = _txManager
                                .createLocalTransaction(true);

                // Cycle through the list of messaging engines.
                while (iterator.hasNext()) {
                    SIBUuid8 jsEngineUUID = new SIBUuid8((String) iterator
                                    .next());

                    if (!jsEngineUUID.equals(new SIBUuid8(_engine.getUuid()))) {
                        // Create the Neighbour
                        _multiMEProxyHandler
                                        .createNeighbour(jsEngineUUID, _engine
                                                        .getBusName(),
                                                         (Transaction) transaction);
                    }

                    _messagingEnginesOnBus.add(jsEngineUUID);
                }

                transaction.commit();
            }
        } catch (SIException e) {
            // FFDC
            FFDCFilter
                            .processException(
                                              e,
                                              "com.ibm.ws.sib.processor.impl.MessageProcessor.configureNeighbours",
                                              "1:2223:1.445", this);

            SibTr.exception(tc, e);

            SIErrorException finalE = new SIErrorException(
                            nls
                                            .getFormattedMessage(
                                                                 "MESSAGE_PROCESSOR_CONFIGURE_NEIGHBOURS_ERROR_CWSIP0391",
                                                                 new Object[] { getMessagingEngineName(), e },
                                                                 null), e);

            if (TraceComponent.isAnyTracingEnabled()
                && tc.isEntryEnabled())
                SibTr.exit(tc, "configureNeighbours", finalE);

            SibTr.error(tc,
                        "MESSAGE_PROCESSOR_CONFIGURE_NEIGHBOURS_ERROR_CWSIP0391",
                        new Object[] { getMessagingEngineName(),
                                      SIMPUtils.getStackTrace(e) });

            throw finalE;
        }

        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "configureNeighbours");
    }
695237
def mount_process(self, process):
    

    for route_path in process.route_paths:
      route = '/%s%s' % (process.pid.id, route_path)
      log.info('Mounting route %s' % route)
      self.app.add_handlers('.*$', [(
          re.escape(route),
          RoutedRequestHandler,
          dict(process=process, path=route_path)
      )])

    for message_name in process.message_names:
      route = '/%s/%s' % (process.pid.id, message_name)
      log.info('Mounting message handler %s' % route)
      self.app.add_handlers('.*$', [(
          re.escape(route),
          WireProtocolMessageHandler,
          dict(process=process, name=message_name)
      )])
837891
def _configure_manager(self):
        
        self._manager = CloudNetworkManager(self, resource_class=CloudNetwork,
                response_key="network", uri_base="os-networksv2")
814835
public void configure() throws Exception {

        final Namespaces ns = new Namespaces("rdf", RDF.uri);
        ns.add("premis", "http://www.loc.gov/premis/rdf/v1#");

        /**
         * A generic error handler (specific to this RouteBuilder)
         */
        onException(Exception.class)
            .maximumRedeliveries("{{error.maxRedeliveries}}")
            .log("Index Routing Error: ${routeId}");

        /**
         * Handle fixity events
         */
        from("{{fixity.stream}}")
            .routeId("FcrepoFixity")
            .to("fcrepo:{{fcrepo.baseUrl}}?preferInclude=ServerManged&accept=application/rdf+xml")
            .filter().xpath(
                    "/rdf:RDF/rdf:Description/rdf:type" +
                    "[@rdf:resource='" + REPOSITORY + "Binary']", ns)
            .log(LoggingLevel.INFO, LOGGER,
                    "Checking Fixity for ${headers[CamelFcrepoUri]}")
            .delay(simple("{{fixity.delay}}"))
            .to("fcrepo:{{fcrepo.baseUrl}}?fixity=true&accept=application/rdf+xml")
            .choice()
                .when().xpath(
                        "/rdf:RDF/rdf:Description/premis:hasEventOutcome" +
                        "[text()='SUCCESS']", ns)
                    .to("{{fixity.success}}")
                .otherwise()
                    .log(LoggingLevel.WARN, LOGGER,
                        "Fixity error on ${headers[CamelFcrepoUri]}")
                    .to("{{fixity.failure}}");
    }
792306
def run(self):
        
        self._setUp()

        naming = 'skunkworks.lbs.%s.%s.%s' % (settings.ENVIRONMENT_STAGE, \
            self.service_name.lower(), self.message_type.lower())

        self.channel.queue_declare(queue=naming, durable=True, exclusive=False, auto_delete=False)
        self.channel.exchange_declare(exchange=naming, type="direct", durable=True, auto_delete=False,)
        self.channel.queue_bind(queue=naming, exchange=naming, routing_key=naming)

        self.channel.basic_consume(queue=self.queue, no_ack=True,
               callback=self._on_message_received,
               consumer_tag=self.__class__.__name__)
        try:
            while True:
                self.channel.wait()
        finally:
            self.channel.basic_cancel(self.__class__.__name__)
1098756
def _setup_services(self):
        
        self.pool = mitogen.service.Pool(
            router=self.router,
            services=[
                mitogen.service.FileService(router=self.router),
                mitogen.service.PushFileService(router=self.router),
                ansible_mitogen.services.ContextService(self.router),
                ansible_mitogen.services.ModuleDepService(self.router),
            ],
            size=getenv_int('MITOGEN_POOL_SIZE', default=32),
        )
        LOG.debug('Service pool configured: size=%d', self.pool.size)
456321
private function routing()
    {
        // import.
        $file = $this->app->getLoader()->findFirst($this->app->config('directory.config.routing') . DS . 'routes.yml');
        $this->router->import($file);

        // routing.
        $rule = $this->router->routing();
        $this->request->import($rule->getParams());

        // add action chain.
        $this->actionChain->addAction($rule->getController(), $rule->getAction());
    }
223712
def _generate_routes_m(self, namespace):
        """"""
        with self.block_m(
                fmt_routes_class(namespace.name, self.args.auth_type)):
            init_args = fmt_func_args_declaration([(
                'client', 'id<{}>'.format(self.args.transport_client_name))])

            with self.block_func(
                    func='init', args=init_args, return_type='instancetype'):
                self.emit('self = [super init];')
                with self.block_init():
                    self.emit('_client = client;')
            self.emit()
            style_to_request = json.loads(self.args.z__style_to_request)

            for route in namespace.routes:
                if (route.attrs.get('auth') != self.args.auth_type
                        and route.attrs.get('auth') != 'noauth'):
                    continue

                route_type = route.attrs.get('style')
                client_args = json.loads(self.args.client_args)

                if route_type in client_args.keys():
                    for args_data in client_args[route_type]:
                        task_type_key, type_data_dict = tuple(args_data)
                        task_type_name = style_to_request[task_type_key]

                        func_suffix = type_data_dict[0]
                        extra_args = [
                            tuple(type_data[:-1])
                            for type_data in type_data_dict[1]
                        ]

                        if (is_struct_type(route.arg_data_type) and
                                self._struct_has_defaults(route.arg_data_type)):
                            route_args, _ = self._get_default_route_args(
                                namespace, route)
                            self._generate_route_m(route, namespace,
                                                   route_args, extra_args,
                                                   task_type_name, func_suffix)

                        route_args, _ = self._get_route_args(namespace, route)
                        self._generate_route_m(route, namespace, route_args,
                                               extra_args, task_type_name,
                                               func_suffix)
                else:
                    task_type_name = style_to_request[route_type]
                    if (is_struct_type(route.arg_data_type) and
                            self._struct_has_defaults(route.arg_data_type)):
                        route_args, _ = self._get_default_route_args(
                            namespace, route)
                        self._generate_route_m(route, namespace, route_args,
                                               [], task_type_name, '')

                    route_args, _ = self._get_route_args(namespace, route)
                    self._generate_route_m(route, namespace, route_args, [],
                                           task_type_name, '')
1194780
def add_route(self, route):
        ''' '''
        self.routes.append(route)
        self.router.add(route.rule, route.method, route, name=route.name)
        if DEBUG: route.prepare()
1185220
def _generate_route_m(self, route, namespace, route_args, extra_args,
                          task_type_name, func_suffix):
        """"""
        user_args = list(route_args)

        transport_args = [
            ('route', 'route'),
            ('arg', 'arg' if not is_void_type(route.arg_data_type) else 'nil'),
        ]

        for name, value, typ in extra_args:
            user_args.append((name, typ))
            transport_args.append((name, value))

        with self.block_func(
                func='{}{}'.format(fmt_route_func(route), func_suffix),
                args=fmt_func_args_declaration(user_args),
                return_type='{} *'.format(task_type_name)):
            self.emit('DBRoute *route = {}.{};'.format(
                fmt_route_obj_class(namespace.name),
                fmt_route_var(namespace.name, route)))
            if is_union_type(route.arg_data_type):
                self.emit('{} *arg = {};'.format(
                    fmt_class_prefix(route.arg_data_type),
                    fmt_var(route.arg_data_type.name)))
            elif not is_void_type(route.arg_data_type):
                init_call = fmt_func_call(
                    caller=fmt_alloc_call(
                        caller=fmt_class_prefix(route.arg_data_type)),
                    callee=self._cstor_name_from_fields_names(route_args),
                    args=fmt_func_args([(f[0], f[0]) for f in route_args]))
                self.emit('{} *arg = {};'.format(
                    fmt_class_prefix(route.arg_data_type), init_call))
            request_call = fmt_func_call(
                caller='self.client',
                callee='request{}'.format(
                    fmt_camel_upper(route.attrs.get('style'))),
                args=fmt_func_args(transport_args))
            self.emit('return {};'.format(request_call))
        self.emit()
262831
function route (message, cb) {
    assert(message, 'route requries a valid message')
    assert(cb && (typeof cb === 'function'), 'route requires a valid callback handler')

    if (message.pattern) {
      return pattern(message, cb)
    }

    if (message.response) {
      return response(message, cb)
    }

    malformed(message, cb)
  }
1044259
protected function configure()
    {
        $text = 'Make a list of view templates from a Concordat package';

        $this->setName('templates')->setDescription($text);

        parent::configure();

        $this->paths['default'] = 'app/views';

        $this->paths['laravel'] = 'resources/views';
    }