Dgraph4j sample app is not clear

Dgraph4j sample app

What Dgraph client (and version) are you using?

(put “x” in the box to select)

  • Dgo
  • PyDgraph
  • Dgraph4J
  • Dgraph-js
  • Dgraph-js-http
  • Dgraph.NET

Version:
20.11.0

What version of Dgraph are you using?

20.11.0

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, OS)?

Steps to reproduce the issue (command/config used to run Dgraph).

  • The sample app in Dgraph4j uses v20.11.0

  • In this line, it returns new DgraphClient(stub), but looking at the source code, I only see a constructor that takes an array of stubs.

  • I am wondering if the sample app needs to be updated?

  • I have also noticed that the sample app doesn’t run without adding the following to build.gradle (ignore the versions):

compile 'com.google.code.gson:gson:2.8.5'
compile 'org.slf4j:slf4j-api:1.6.1'
compile 'org.slf4j:slf4j-simple:1.6.1'

Expected behaviour and actual result.

Just need clarification on what’s the correct way of creating a client.

Also, the utility of withAuthHeader is quite not evident in the first look. Let’s say we set up with withAuthHeader to be true. How would the example change? Does every call to the db from dgraph4j need to supply that the-auth-token-value for the call to go through? It’d be great if the example could be extended with the usage-case for withAuthHeader being true. Thanks.