Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute next handlers after jerseyHandler is executed #78

Open
nitishgoyal13 opened this issue May 2, 2020 · 0 comments
Open

Execute next handlers after jerseyHandler is executed #78

nitishgoyal13 opened this issue May 2, 2020 · 0 comments

Comments

@nitishgoyal13
Copy link

Hi,

I have a use case where I want to execute jersey handlers before passing the routingContext to next handlers. I want to chain the executions and execute them only in async manner

Since jersey handler takes HttpServerRequest as an input, I am not able to execute routingContext.next(); inside the VertxRequestProcessor to proceed ahead with the execution.

Any suggestions on how to proceed ahead with the execution

One work around for the same (which can't be deployed in production)


public void register() {
        router.route("/apis/:service/*")
                .method(HttpMethod.GET)
                .handler(this::requestDecrypter)
                .handler(this::executeApiRequest);

        router.route("/apis/:service/*")
                .method(HttpMethod.POST)
                .handler(this::requestDecrypter);

        router.route("/apis/:service/*")
                .method(HttpMethod.POST)
                .handler(this::executeApiRequest);
    }

private void requestDecrypter(RoutingContext routingContext) {
        jerseyHandler.handle(routingContext.request());
        routingContext.vertx()
                .setTimer(500, event -> {
                    routingContext.next();
                });

    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant