Skip to content

Allow customize async running or fully disable library async logic. #563

Open
@nathanmolinari

Description

@nathanmolinari

Is your feature request related to a problem? Please describe.

I would like to code something like this, if operation is x, then execute in threadpool y. But the library do not give me this flexibility, i can only inform one threadpool that all async tasks will run.

Describe the solution you'd like

I would like that i can set my own HttpRequestHandlerImpl and HttpRequestInvokerImpl where i'm going to code my execution logic with fully flexibility to choose which threadpool i`m going to use to each scenario.

Also change the visibility of methods from HttpRequestInvokerImpl, by doing this, i can code something like

	public class MyHttpRequestInvokerImpl extends HttpRequestInvokerImpl {
		@Override
		public void execute(
				GraphQLInvocationInput invocationInput,
				HttpServletRequest request,
				HttpServletResponse response,
				ListenerHandler listenerHandler) {

			if(someLogic) {
				runAsync(myThreadPool, super.handle(invocationInput, request, response, listenerHandler));
			} else {
				super.execute(...args)
			}
		}

	}

Other option would be to check on HttpRequestInvokerImpl.java#L45 if property graphql.servlet.async.enabled is true. If not the library should not execute tasks async. By doing this, i can fully disable library async logic, and code a customized one.

Describe alternatives you've considered

Before async support (older versions) we coded by ourselves async running. When upgraded the async logic just broke because the library try to run async again when isAsyncSupported() returns true.
https://github.com/graphql-java-kickstart/graphql-java-servlet/blob/master/graphql-java-servlet/src/main/java/graphql/kickstart/servlet/HttpRequestInvokerImpl.java#L45

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @nathanmolinari

        Issue actions

          Allow customize async running or fully disable library async logic. · Issue #563 · graphql-java-kickstart/graphql-java-servlet