Skip to content

Commit 3bc0857

Browse files
Merge pull request #1 from apollosolutions/feature/add-java-coprocessor
Add java coprocessor and rename js coprocessor
2 parents 956e9bf + 4ed96f9 commit 3bc0857

File tree

18 files changed

+857
-5
lines changed

18 files changed

+857
-5
lines changed

README.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This repository demonstrates how to setup a skeleton coprocessor that simply log
77
> Note: To run this example, you will need a GraphOS Enterprise plan and must create `/router/.env` based on `/router/.env.example` which exports `APOLLO_KEY` and `APOLLO_GRAPH_REF`.
88
99
1. Run the subgraph from the `/subgraph` directory with `npm run dev`
10-
1. Run the coprocessor from the `/coprocessor` directory with `npm run dev`
10+
1. Run the coprocessor based on your language of choice by following the README from the appropriate `/*-coprocessor` directory ([javascript](./js-coprocessor/README.md), [Java](./java-coprocessor/README.md)).
1111
1. In the `/router` directory, download the router by running `./download_router.sh`
1212
1. In the `/router` directory, compose the schema by running `./create_local_schema.sh`
1313
1. In the `/router` directory, run the router by running `./start_router.sh`
@@ -21,7 +21,3 @@ Now if you run this code in the browser (http://127.0.0.1:4000/), you will be ab
2121
In `router/router-config.yaml`, the coprocessor is configured with the Router to be called on the `router` `request` stage.
2222

2323
### Coprocessor
24-
25-
In `coprocessor/src/index.js`, the coprocessor is setup with `express` to listen to the `/` POST endpoint and respond to the `RouterRequest` stage.
26-
27-
In the `processRouterRequestStage` function, the payload is logged.

java-coprocessor/.gitignore

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.idea/
2+
target/
3+
pom.xml.tag
4+
pom.xml.releaseBackup
5+
pom.xml.versionsBackup
6+
pom.xml.next
7+
release.properties
8+
dependency-reduced-pom.xml
9+
buildNumber.properties
10+
.mvn/timing.properties
11+
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
12+
.mvn/wrapper/maven-wrapper.jar
13+
14+
# Eclipse m2e generated files
15+
# Eclipse Core
16+
.project
17+
# JDT-specific (Eclipse Java Development Tools)
18+
.classpath
19+
20+
# Compiled class file
21+
*.class
22+
23+
# Log file
24+
*.log
25+
26+
# BlueJ files
27+
*.ctxt
28+
29+
# Mobile Tools for Java (J2ME)
30+
.mtj.tmp/
31+
32+
# Package Files #
33+
*.jar
34+
*.war
35+
*.nar
36+
*.ear
37+
*.zip
38+
*.tar.gz
39+
*.rar
40+
41+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
42+
hs_err_pid*
43+
replay_pid*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar

java-coprocessor/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Java Coprocessor
2+
3+
## Run
4+
5+
1. _(Optional)_ Install [SDK Man](https://sdkman.io/)
6+
- This can help with installing and managing different Java versions
7+
1. Start the coprocessor using `mvn`
8+
```shell
9+
./mvnw spring-boot:run
10+
```
11+
2. [Start the router](/router/README.md#running-the-router)

0 commit comments

Comments
 (0)