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

graphql.kickstart.execution.subscriptions.apollo.SubscriptionConnectionTerminateCommand Maven / Gradle / Ivy

The newest version!
package graphql.kickstart.execution.subscriptions.apollo;

import static graphql.kickstart.execution.subscriptions.apollo.OperationMessage.Type.GQL_CONNECTION_TERMINATE;

import graphql.kickstart.execution.subscriptions.SubscriptionSession;
import java.util.Collection;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@RequiredArgsConstructor
class SubscriptionConnectionTerminateCommand implements SubscriptionCommand {

  private final Collection connectionListeners;

  @Override
  public void apply(SubscriptionSession session, OperationMessage message) {
    connectionListeners.forEach(it -> it.onTerminate(session, message));
    session.close("client requested " + GQL_CONNECTION_TERMINATE.getValue());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy