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

com.apollographql.subscription.message.CallbackMessageComplete Maven / Gradle / Ivy

package com.apollographql.subscription.message;

import graphql.GraphQLError;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * complete message is send to the Router to terminate active
 * subscription. Subscription can terminate either by reaching end of the data stream OR by
 * encountering an error that caused subscription to fail.
* If subscription failed due to an error, complete message should include list of * GraphQLErrors that caused the failure. * * @param id unique subscription ID * @param verifier value provided by Router that is used to validate requests * @param errors optional list of errors if subscription terminated abnormally */ public record CallbackMessageComplete(String id, String verifier, List errors) implements SubscritionCallbackMessage { public CallbackMessageComplete(String id, String verifier) { this(id, verifier, Collections.emptyList()); } @Override public CallbackMessageAction getAction() { return CallbackMessageAction.COMPLETE; } @Override public String getId() { return id; } @Override public String getVerifier() { return verifier; } public List> getErrors() { return errors.stream().map(GraphQLError::toSpecification).collect(Collectors.toList()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy