A gRPC service to proxy (broadcast) stream of events from Azure EventHub to multiple clients.
A client calls Subscribe()
on proxy. Once there are events in the EventHub, the proxy server streams events by calling ReceiveEvents()
on each client.
This project is built using bazel in version >= 3.7.0. More information on Bazel: https://bazel.build/. More information on Bazelisk: https://github.com/bazelbuild/bazelisk.
You need to use Python >= 3.8.
Configuration is done using flags.
Flags can be defined in flag_files/server_flags
. To get detailed help on flags, run:
bazelisk run eventhub_stream_proxy:eventhub_stream_proxy -- --help
bazelisk run eventhub_stream_proxy:example_client -- --help
More information on flags: https://abseil.io/docs/python/guides/flags
bazelisk run eventhub_stream_proxy:eventhub_stream_proxy -- --flagfile=`pwd`/flag_files/server_flags
bazelisk run eventhub_stream_proxy:example_client -- --eventhub_stream_proxy_address=localhost:50002
Contract is defined in proto: proto/event.proto
.
- A client subscribes (
EventSubscription::Subscribe
) to a server to get the stream of events (Event
). - A client implements
EventReceiver
to run each time new event is streamed.
More information on proto: https://developers.google.com/protocol-buffers/docs/proto3
Please refer to eventhub_stream_proxy/example_client.py
, where there is an example client implementation in Python.
Since the service is written using gRPC, a client can be desinged using any framework supported by gRPC.
More information on gRPC: https://grpc.io/
bazelisk test ...:all
Append following rule to eventhub_stream_proxy/BUILD
file:
container_push(
name = "eventhub_stream_proxy_image_push",
format = "Docker",
image = ":eventhub_stream_proxy_image",
registry = "YOUR_IMAGE_REGISTRY",
repository = "YOUR_IMAGE_REPOSITORY",
tag = "{BUILD_EMBED_LABEL}",
)
Replace YOUR_IMAGE_REGISTRY
and YOUR_IMAGE_REPOSITORY
with your values.
Then run the image push:
bazelisk run eventhub_stream_proxy:eventhub_stream_proxy_image_push --embed_label=1.2.3.4