INNER CODE UNIT · Java

intercept

apollographql/federation-jvm · spring-subscription-callback/src/main/java/com/apollographql/subscription/CallbackWebGraphQLInterceptor.java:71

  public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain) {
    // in order to correctly handle parsing of ANY requests (i.e. it is valid to define a
    // document with query fragments first) we would need to parse it which is a much heavier
    // operation, we may opt to do it in the future releases
    if (!isWebSocketRequest(request) && request.getDocument().startsWith("subscription")) {
      return parseSubscriptionCallbackExtension(request.getExtensions())
          .flatMap(
              callback -> {
                if (logger.isDebugEnabled()) {
                  logger.debug("Starting subscription using callback: " + callback);
                }
                var callbackWithContextualData =
                    callback.withContext(parseContextualHeaders(request));
                return this.subscriptionCallbackHandler
                    .handleSubscriptionUsingCallback(request, callbackWithContextualData)
                    .map(response -> callbackResponse(request, response));
              })
          .onErrorResume(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…