Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit 9f62ff1

Browse files
authored
feat: Add Direct Runner for Beam Java SDK Example (#307)
1 parent 9fabb5d commit 9f62ff1

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

docs/beam_guide.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ example job with the Flink Operator. You can write a script to automate the proc
6161
```bash
6262
kubectl apply -f examples/beam/without_job_server/beam_wordcount_py.yaml
6363
```
64+
65+
As for Java SDK, you can use the following file to submit the example job:
66+
67+
```bash
68+
kubectl apply -f examples/beam/without_job_server/beam_wordcount_java.yaml
69+
```
6470

6571
## Known issues
6672

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
name: beam-wordcount-java
5+
spec:
6+
template:
7+
metadata:
8+
labels:
9+
app: beam-wordcount-java
10+
spec:
11+
containers:
12+
- name: beam-wordcount-java
13+
image: apache/beam_java_sdk:2.22.0
14+
command: ["/bin/bash", "-c"]
15+
args:
16+
- |
17+
apt-get update && apt-get install -y maven
18+
mvn archetype:generate -DarchetypeGroupId=org.apache.beam -DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples -DarchetypeVersion=2.22.0 -DgroupId=org.example -DartifactId=word-count-beam -Dversion="0.1" -Dpackage=org.apache.beam.examples -DinteractiveMode=false
19+
cd word-count-beam
20+
mvn package -Pflink-runner
21+
mvn exec:java -Dexec.mainClass=org.apache.beam.examples.WordCount \
22+
-Pflink-runner \
23+
-Dexec.args="--runner=FlinkRunner \
24+
--inputFile=/etc/ucf.conf \
25+
--output=/tmp/output \
26+
--flinkMaster=beam-flink-cluster-jobmanager:8081 \
27+
--filesToStage=target/word-count-beam-bundled-0.1.jar"
28+
restartPolicy: Never

0 commit comments

Comments
 (0)