Class GraphQlMessageHandler

All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanClassLoaderAware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Ordered, ExpressionCapable, Orderable, MessageProducer, HeaderPropagationAware, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>

public class GraphQlMessageHandler extends AbstractReplyProducingMessageHandler
An AbstractReplyProducingMessageHandler capable of fielding GraphQL Query, Mutation and Subscription requests.
Since:
6.0
Author:
Daniel Frey, Artem Bilan
  • Constructor Details

    • GraphQlMessageHandler

      public GraphQlMessageHandler(org.springframework.graphql.ExecutionGraphQlService graphQlService)
  • Method Details

    • setOperation

      public void setOperation(String operation)
      Specify a GraphQL Operation.
      Parameters:
      operation - the GraphQL operation to use.
    • setOperationExpression

      public void setOperationExpression(Expression operationExpression)
      Specify a SpEL expression to evaluate a GraphQL Operation
      Parameters:
      operationExpression - the expression to evaluate a GraphQL Operation.
    • setOperationName

      public void setOperationName(String operationName)
      Set a GraphQL Operation Name to execute.
      Parameters:
      operationName - the GraphQL Operation Name to use.
    • setOperationNameExpression

      public void setOperationNameExpression(Expression operationNameExpression)
      Set a SpEL expression to evaluate a GraphQL Operation Name to execute.
      Parameters:
      operationNameExpression - the expression to use.
    • setVariablesExpression

      public void setVariablesExpression(Expression variablesExpression)
      Set a SpEL expression to evaluate Variables for GraphQL Operation to execute.
      Parameters:
      variablesExpression - the expression to use.
    • setLocale

      public void setLocale(@Nullable Locale locale)
      Set a Locale for GraphQL Operation to execute.
      Parameters:
      locale - the locale to use.
    • setExecutionIdExpression

      public void setExecutionIdExpression(Expression executionIdExpression)
      Set a SpEL expression to evaluate Execution Id for GraphQL Operation Request to execute.
      Parameters:
      executionIdExpression - the executionIdExpression to use.
    • doInit

      protected final void doInit()
      Overrides:
      doInit in class AbstractReplyProducingMessageHandler
    • handleRequestMessage

      protected Object handleRequestMessage(Message<?> requestMessage)
      Description copied from class: AbstractReplyProducingMessageHandler
      Subclasses must implement this method to handle the request Message. The return value may be a Message, a MessageBuilder, or any plain Object. The base class will handle the final creation of a reply Message from any of those starting points. If the return value is null, the Message flow will end here.
      Specified by:
      handleRequestMessage in class AbstractReplyProducingMessageHandler
      Parameters:
      requestMessage - The request message.
      Returns:
      The result of handling the message, or null.