use of com.yahoo.elide.graphql.subscriptions.containers.SubscriptionNodeContainer in project elide by yahoo.
the class SubscriptionDataFetcher method get.
@Override
public Object get(DataFetchingEnvironment environment) throws Exception {
OperationDefinition.Operation op = environment.getOperationDefinition().getOperation();
if (op != OperationDefinition.Operation.SUBSCRIPTION) {
throw new InvalidEntityBodyException(String.format("%s not supported for subscription models.", op));
}
/* build environment object, extracts required fields */
Environment context = new Environment(environment, nonEntityDictionary);
/* safe enable debugging */
if (log.isDebugEnabled()) {
logContext(log, RelationshipOp.FETCH, context);
}
if (context.isRoot()) {
String entityName = context.field.getName();
String aliasName = context.field.getAlias();
EntityProjection projection = context.requestScope.getProjectionInfo().getProjection(aliasName, entityName);
Flowable<PersistentResource> recordPublisher = PersistentResource.loadRecords(projection, new ArrayList<>(), context.requestScope).toFlowable(BackpressureStrategy.BUFFER).onBackpressureBuffer(bufferSize, true, false);
return recordPublisher.map(SubscriptionNodeContainer::new);
}
// as the PersistentResourceFetcher.
return context.container.processFetch(context);
}
Aggregations