Skip to content

Latest commit

 

History

History
95 lines (69 loc) · 3.75 KB

README.md

File metadata and controls

95 lines (69 loc) · 3.75 KB

GraphQL Federation Gateway

Build codecov GitHub Last Commit Github issues

A Graphql Federation Gateway implemented using Ballerina as the underline technology. This will generate a gateway executable for a given supergraph schema.

Using the Gateway

Prerequisites

  1. Download and install Java SE Development Kit (JDK) version 17 (from one of the following locations).

    • Oracle

    • OpenJDK

      Note: Set the JAVA_HOME environment variable to the path name of the directory into which you installed JDK.

  2. Download and install Ballerina

Steps to use the gateway.

  1. Download gateway.sh

  2. To start the gateway run the following command in the terminal.

./gateway.sh -s <supergraphPath> -p <port>
  • supergraphPath is a mandatory argument.
  • If the port is not provided the default port 9090 will be used.

Try out the example

  1. Navigate into examples/astronauts_missions_example directory. There's two federated graphql services and a supergraph schema.
  2. In terminal execute ./gateway.sh -s supergraph.graphql to start the gateway.
  3. In terminal execute bal run inside both astronauts_service and missions_service directories to start the subgraph services.
  4. Navigate into astronuats_service directory and execute bal run in the terminal to start the astronauts_service subgraph service.
  5. Navigate into missions_service directory and execute bal run in the terminal to start the missions_service subgraph service.
  6. Try out the following query in the graphql client.
query {
    astronauts {
        id
        name
        missions {
            id
            designation
        }
    }
}

Build from the source.

Setup the prerequisites

  1. Download and install Java SE Development Kit (JDK) version 17 (from one of the following locations).

    • Oracle

    • OpenJDK

      Note: Set the JAVA_HOME environment variable to the path name of the directory into which you installed JDK.

  2. Export your Github personal access token with the read package permissions as follows.

      export packageUser=<Username>
      export packagePAT=<Personal access token>
    

Build the source

Execute the commands below to build from the source.

Note: When running the build with test in Windows use -Pdisable=invalid-permission to skip the Windows incompatible test cases.

  1. To build the project:
./gradlew clean build
  1. To run the tests
./gradlew clean test
  1. To build the project without tests:
./gradlew clean build -x test
  1. Publish jar artifact to the local .m2 repository:
./gradlew clean build publishToMavenLocal