Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

nfl/graphql-rxjava

Repository files navigation

graphql-rxjava

This is an execution strategy for graphql-java that makes it easier to use rxjava's Observable. It currently requires Java8.

Build Status

Table of Contents

Rx Hello World

This is the famous "hello world" in graphql-rxjava:

import graphql.schema.GraphQLObjectType;
import graphql.schema.GraphQLSchema;
import graphql.execution.RxExecutionStrategy;
import graphql.execution.RxExecutionResult;
import static graphql.Scalars.GraphQLString;
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
import static graphql.schema.GraphQLObjectType.newObject;
public class HelloWorld {
 public static void main(String[] args) {
 GraphQLObjectType queryType = newObject()
 .name("helloWorldQuery")
 .field(newFieldDefinition()
 .type(GraphQLString)
 .name("hello")
 .staticValue(Observable.just("world")))
 .build())
 .build();
 GraphQLSchema schema = GraphQLSchema.newSchema()
 .query(queryType)
 .build();
 Observable<?> result = ((RxExecutionResult)new GraphQL(schema, new RxExecutionStrategy()).execute("{hello}")).getDataObservable();
 result.subscribe(System.out::println);
 // Prints: {hello=world}
 }
}

Getting started with gradle

Make sure mavenCentral is among your repos:

repositories {
 mavenCentral()
}

Dependency:

dependencies {
 compile 'com.graphql-java:graphql-rxjava:0.0.1'
}

License

graphql-rxjava is licensed under the MIT License. See LICENSE for details.

Copyright (c) 2015, NFL and Contributors

graphql-js License

About

GraphQL RxJava

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /