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

graphql.kickstart.servlet.subscriptions.FallbackSubscriptionProtocolFactory Maven / Gradle / Ivy

There is a newer version: 16.0.0
Show newest version
package graphql.kickstart.servlet.subscriptions;

import graphql.kickstart.execution.GraphQLInvoker;
import graphql.kickstart.execution.subscriptions.GraphQLSubscriptionInvocationInputFactory;
import graphql.kickstart.execution.subscriptions.GraphQLSubscriptionMapper;
import graphql.kickstart.execution.subscriptions.SubscriptionProtocolFactory;
import graphql.kickstart.execution.subscriptions.SubscriptionSession;
import java.util.function.Consumer;
import javax.websocket.Session;

/** @author Andrew Potter */
public class FallbackSubscriptionProtocolFactory extends SubscriptionProtocolFactory
    implements WebSocketSubscriptionProtocolFactory {

  private final GraphQLSubscriptionMapper mapper;
  private final GraphQLSubscriptionInvocationInputFactory invocationInputFactory;
  private final GraphQLInvoker graphQLInvoker;

  public FallbackSubscriptionProtocolFactory(
      GraphQLSubscriptionMapper mapper,
      GraphQLSubscriptionInvocationInputFactory invocationInputFactory,
      GraphQLInvoker graphQLInvoker) {
    super("");
    this.mapper = mapper;
    this.invocationInputFactory = invocationInputFactory;
    this.graphQLInvoker = graphQLInvoker;
  }

  @Override
  public Consumer createConsumer(SubscriptionSession session) {
    return new FallbackSubscriptionConsumer(
        session, mapper, invocationInputFactory, graphQLInvoker);
  }

  @Override
  public SubscriptionSession createSession(Session session) {
    return new WebSocketSubscriptionSession(mapper, session);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy