All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graphql.kickstart.execution.instrumentation.RequestLevelTrackingApproach Maven / Gradle / Ivy

The newest version!
package graphql.kickstart.execution.instrumentation;

import graphql.execution.ExecutionId;
import graphql.execution.instrumentation.InstrumentationState;
import java.util.List;
import org.dataloader.DataLoaderRegistry;

/** Dispatching approach that expects to know about all executions before execution starts. */
public class RequestLevelTrackingApproach extends AbstractTrackingApproach {

  public RequestLevelTrackingApproach(
      List executionIds, DataLoaderRegistry dataLoaderRegistry) {
    super(dataLoaderRegistry);
    RequestStack requestStack = getStack();
    executionIds.forEach(requestStack::addExecution);
  }

  @Override
  public InstrumentationState createState(ExecutionId executionId) {
    if (!getStack().contains(executionId)) {
      throw new TrackingApproachException(
          String.format("Request tracking not set up with execution id %s", executionId));
    }
    return null;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy