Skip to content

Commit 6c1bc9f

Browse files
authored
Added notifcation API and eventstore API example (#30)
* Added notification API and eventstore API example * Build file changes for using public protos from engflowapis Few changes in code and docs * Divided creation of channel and pull into two different try statements * Added parser for options * Client example is now able against clusters with certificate auth and tokens auth It is possible then to use github tokens for talking with the envoy cluster It is possible then to use .crt and .key files for talking with engflow canary cluster * Added more details to documentation * Removed local_repository googleapis * Changed git_repository for http_archive for engflowapis dependency * Code formatted and exception added to channel creation
1 parent 9c62c52 commit 6c1bc9f

File tree

5 files changed

+593
-0
lines changed

5 files changed

+593
-0
lines changed

WORKSPACE

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
2+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
3+
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
24

5+
# Some file dependencies
36
http_file(
47
name = "emacs",
58
sha256 = "1439bf7f24e5769f35601dbf332e74dfc07634da6b1e9500af67188a92340a28",
@@ -17,3 +20,105 @@ http_file(
1720
"https://mirror.pit.teraswitch.com/ubuntu-releases/focal/ubuntu-20.04.4-live-server-amd64.iso",
1821
],
1922
)
23+
24+
http_archive(
25+
name = "rules_jvm_external",
26+
sha256 = "c21ce8b8c4ccac87c809c317def87644cdc3a9dd650c74f41698d761c95175f3",
27+
strip_prefix = "rules_jvm_external-1498ac6ccd3ea9cdb84afed65aa257c57abf3e0a",
28+
url = "https://github.com/bazelbuild/rules_jvm_external/archive/1498ac6ccd3ea9cdb84afed65aa257c57abf3e0a.zip",
29+
)
30+
31+
http_archive(
32+
name = "com_google_googleapis",
33+
sha256 = "25bba87daac3f4f7b9f5cd4632ade645de0d41d9600feccfbe6cbdf0cc8f6ae6",
34+
strip_prefix = "googleapis-4f46ddcc9349121b27331e5cb5d18c553696a6c3",
35+
urls = [
36+
"https://storage.googleapis.com/engflow-tools-public/googleapis-4f46ddcc9349121b27331e5cb5d18c553696a6c3.tar.gz",
37+
"https://github.com/googleapis/googleapis/archive/4f46ddcc9349121b27331e5cb5d18c553696a6c3.tar.gz",
38+
],
39+
)
40+
41+
http_archive(
42+
name = "com_engflow_engflowapis",
43+
sha256 = "a04a2d2a978355c85dff8b1018d12a8e0a1e6692add9de716fd4d1b7aa1e2a0d",
44+
strip_prefix = "engflowapis-47aa858b498da13e7863356aaef9c6d05da0a7f2",
45+
urls = [
46+
"https://storage.googleapis.com/engflow-tools-public/engflowapis-47aa858b498da13e7863356aaef9c6d05da0a7f2.zip",
47+
"https://github.com/EngFlow/engflowapis/archive/47aa858b498da13e7863356aaef9c6d05da0a7f2.zip",
48+
],
49+
)
50+
51+
http_archive(
52+
name = "io_grpc_grpc_java",
53+
sha256 = "51bac553d269b97214dbd6aee4e65fc616d8ccd414fc12d708e85979ed4c19b4",
54+
strip_prefix = "grpc-java-1.45.1",
55+
urls = ["https://github.com/grpc/grpc-java/archive/v1.45.1.tar.gz"],
56+
)
57+
58+
http_archive(
59+
name = "rules_proto",
60+
sha256 = "e017528fd1c91c5a33f15493e3a398181a9e821a804eb7ff5acdd1d2d6c2b18d",
61+
strip_prefix = "rules_proto-4.0.0-3.20.0",
62+
urls = [
63+
"https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0-3.20.0.tar.gz",
64+
],
65+
)
66+
67+
# Loads rules required to compile proto files
68+
http_archive(
69+
name = "rules_proto_grpc",
70+
sha256 = "28724736b7ff49a48cb4b2b8cfa373f89edfcb9e8e492a8d5ab60aa3459314c8",
71+
strip_prefix = "rules_proto_grpc-4.0.1",
72+
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/4.0.1.tar.gz"],
73+
)
74+
75+
load("@rules_proto_grpc//java:repositories.bzl", rules_proto_grpc_java_repos = "java_repos")
76+
77+
rules_proto_grpc_java_repos()
78+
79+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
80+
load("@rules_jvm_external//:defs.bzl", "maven_install")
81+
82+
rules_proto_dependencies()
83+
84+
rules_proto_toolchains()
85+
86+
http_archive(
87+
name = "com_google_protobuf",
88+
sha256 = "990e47a163b4057f98b899eca591981b5b735872b58f59b9ead9cecabbb21a2a",
89+
strip_prefix = "protobuf-21.4",
90+
urls = [
91+
"https://github.com/protocolbuffers/protobuf/archive/v21.4.tar.gz",
92+
],
93+
)
94+
95+
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
96+
97+
protobuf_deps()
98+
99+
load("@io_grpc_grpc_java//:repositories.bzl", "IO_GRPC_GRPC_JAVA_ARTIFACTS", "IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS", "grpc_java_repositories")
100+
101+
grpc_java_repositories()
102+
103+
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
104+
105+
switched_rules_by_language(
106+
name = "com_google_googleapis_imports",
107+
java = True,
108+
)
109+
110+
maven_install(
111+
artifacts = IO_GRPC_GRPC_JAVA_ARTIFACTS + [
112+
"commons-cli:commons-cli:1.3.1",
113+
"com.google.oauth-client:google-oauth-client:1.34.1",
114+
],
115+
generate_compat_repositories = True,
116+
override_targets = IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS,
117+
repositories = [
118+
"https://repo.maven.apache.org/maven2/",
119+
],
120+
)
121+
122+
load("@maven//:compat.bzl", "compat_repositories")
123+
124+
compat_repositories()
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library")
4+
5+
java_proto_library(
6+
name = "engflowapis_java_proto",
7+
visibility = ["//visibility:public"],
8+
deps = [
9+
"@com_engflow_engflowapis//engflow/eventstore/v1:build_event_proto",
10+
"@com_engflow_engflowapis//engflow/eventstore/v1:eventstore_proto",
11+
"@com_engflow_engflowapis//engflow/eventstore/v1:notifications_proto",
12+
"@com_engflow_engflowapis//engflow/notification/v1:notification_proto",
13+
"@com_engflow_engflowapis//engflow/notification/v1:notification_queue_proto",
14+
],
15+
)
16+
17+
java_grpc_library(
18+
name = "notification_queue_java_grpc",
19+
srcs = [
20+
"@com_engflow_engflowapis//engflow/notification/v1:notification_queue_proto",
21+
],
22+
deps = [
23+
":engflowapis_java_proto",
24+
],
25+
)
26+
27+
java_grpc_library(
28+
name = "eventstore_java_grpc",
29+
srcs = [
30+
"@com_engflow_engflowapis//engflow/eventstore/v1:eventstore_proto",
31+
],
32+
deps = [
33+
":engflowapis_java_proto",
34+
],
35+
)
36+
37+
java_binary(
38+
name = "client",
39+
srcs = [
40+
"Client.java",
41+
"NotificationOptions.java",
42+
],
43+
main_class = "com.engflow.notificationqueue.Client",
44+
deps = [
45+
":engflowapis_java_proto",
46+
":eventstore_java_grpc",
47+
":notification_queue_java_grpc",
48+
"@com_google_protobuf//:any_proto",
49+
"@com_google_protobuf//java/core",
50+
"@io_grpc_grpc_java//api",
51+
"@io_grpc_grpc_java//context",
52+
"@io_grpc_grpc_java//netty",
53+
"@io_grpc_grpc_java//stub",
54+
"@maven//:com_google_code_findbugs_jsr305",
55+
"@maven//:com_google_guava_guava",
56+
"@maven//:commons_cli_commons_cli",
57+
"@maven//:io_netty_netty_handler",
58+
],
59+
)

0 commit comments

Comments
 (0)