Search in sources :

Example 1 with Depot

use of io.vertx.up.atom.agent.Depot in project vertx-zero by silentbalanceyh.

the class EventAxis method mount.

/**
 * Secreter for security limitation
 * 1. Authorization
 * 2. Authorize
 */
@Override
public void mount(final Router router) {
    // Extract Event foreach
    EVENTS.forEach(event -> {
        // Build Route and connect to each Action
        Fn.safeSemi(null == event, LOGGER, () -> LOGGER.warn(Info.NULL_EVENT, getClass().getName()), () -> {
            // 1. Verify
            Verifier.verify(event);
            final Route route = router.route();
            // 2. Path, Method, Order
            Hub<Route> hub = Fn.poolThread(Pool.URIHUBS, () -> Instance.instance(UriHub.class));
            hub.mount(route, event);
            // 3. Consumes/Produces
            hub = Fn.poolThread(Pool.MEDIAHUBS, () -> Instance.instance(MediaHub.class));
            hub.mount(route, event);
            // 4. Request validation
            final Depot depot = Depot.create(event);
            // 5. Request workflow executor: handler
            final Aim<RoutingContext> aim = this.splitter.distribute(event);
            /**
             * 6. Handler chain
             * 1) Mime Analyzer ( Build arguments )
             * 2) Validation
             * 3) Execute handler ( Code Logical )
             * 4) Uniform failure handler
             */
            route.handler(this.verifier.signal(depot)).handler(aim.attack(event)).failureHandler(CommonEndurer.create());
        });
    });
}
Also used : RoutingContext(io.vertx.ext.web.RoutingContext) Depot(io.vertx.up.atom.agent.Depot) Route(io.vertx.ext.web.Route)

Example 2 with Depot

use of io.vertx.up.atom.agent.Depot in project vertx-zero by silentbalanceyh.

the class EventAxis method mount.

@Override
public void mount(final Router router) {
    // Extract Event foreach
    EVENTS.forEach(event -> {
        // Build Route and connect to each Action
        Fn.safeSemi(null == event, LOGGER, () -> LOGGER.warn(Info.NULL_EVENT, getClass().getName()), () -> {
            // 1. Verify
            Verifier.verify(event);
            final Route route = router.route();
            // 2. Path, Method, Order
            Hub<Route> hub = Fn.poolThread(Pool.URIHUBS, () -> Instance.instance(UriHub.class));
            hub.mount(route, event);
            // 3. Consumes/Produces
            hub = Fn.poolThread(Pool.MEDIAHUBS, () -> Instance.instance(MediaHub.class));
            hub.mount(route, event);
            // 4. Request validation
            final Depot depot = Depot.create(event);
            // 5. Request workflow executor: handler
            final Aim aim = this.splitter.distribute(event);
            route.handler(this.verifier.signal(depot)).failureHandler(ZeroRxEndurer.create());
        });
    });
}
Also used : Aim(io.vertx.up.rs.Aim) Depot(io.vertx.up.atom.agent.Depot) Route(io.vertx.reactivex.ext.web.Route)

Aggregations

Depot (io.vertx.up.atom.agent.Depot)2 Route (io.vertx.ext.web.Route)1 RoutingContext (io.vertx.ext.web.RoutingContext)1 Route (io.vertx.reactivex.ext.web.Route)1 Aim (io.vertx.up.rs.Aim)1