Use Kotlin library for a simple Java client

Hello there,

I am trying to implement a GraphQL client in Java. From the documentation I see that Apollo is supposed to work with Java (see here). What I don’t understand is, do I need RxJava for this to work or is there a pure Java version? For now, I don’t require asynchronous access so a synchronous Java version would do just fine.

This far I have generated Java sources for a GraphQL schema & query and initialized a client. I am now struggling to execute the query:

ApolloResponse response = apolloClient.query(new MyQuery()).execute();


  1. Is a pure Java client version supported? (i.e., without RxJava)
  2. If so, how do I execute the query?
  3. And, where do I get the type info? (i.e. ApolloResponse<MyData>)

Also, if you know of a full Java example somewhere, please share. :slight_smile:

Hi :wave:

Currently Apollo Kotlin exposes suspend and Flow APIs that are meant to be consumed from Kotlin, that being said, we do have adapters for Rx2 and Rx3 - the doc on how to use that is here.

For the future, we also have this issue open about better supporting Java, that you can +1 and comment on if you have any feedback about this.

Ok, so basically if I want to use Java it’s Rx2 or Rx3.

Good to know, thanks!