Pub/Sub Emulator Gateway for Kafka
This project implements a gRPC gateway server based on gRPC Gateway, The gateway is exposed as a standalone Go Lang application with mandatory configuration of address to connect on Pub/Sub Emulator for Kafka passed as an argument at runtime, creating gateway a server with REST endpoints of Pub/Sub services.
Building and Running
Checkout the source and then build executing the
./build.sh install. This will generate a binary content of application at
To start the application, you must have the Pub/Sub Emulator for Kafka running on your machine and
specify the host and port using
--address command line argument.
./cmd/kafka-pubsub-emulator-gateway start -a localhost:8080
Pub/Sub Emulator Gateway for Kafka will run by default on port 8181 but you can change. More details can be found in the Configuration Arguments section below.
This configuration will build kafka-pubusb-emulator-gateway inside the container.
docker build -t kafka-pubsub-emulator-gateway:22.214.171.124 . docker run -p 8181:8181 kafka-pubsub-emulator-gateway:126.96.36.199 -a localhost:8080
After finish build process execute
docker run -p 8181:8181 kafka-pubsub-emulator-gateway:188.8.131.52 -a localhost:8080 to launch the application.
The configuration for Kubernetes was based on Minikube. To configure see more here.
This example uses the default configuration from resources folders, it assumes that you have a Minikube instance of a Pub/Sub Kafka Emulator running on port 30080. (If you are running locally change the address port of kubernetes/kafka-pubsub-emulator-gateway-deployment.yaml file)
Build kafka pubsub emulator gateway container:
cd go/src/kafka-pubsub-emulator-gateway docker build -t kafka-pubsub-emulator-gateway:184.108.40.206 .
Create deployment of kafka-emulator-gateway see more, with 1 application pods.
export PUBSUB_EMULATOR_MINIKUBE_IP=$(minikube ip) kubectl create configmap emulator-info --from-literal ip=$PUBSUB_EMULATOR_MINIKUBE_IP kubectl create -f kubernetes/kafka-pubsub-emulator-gateway-deployment.yaml
Create service load balancer for kafka-emulator-gateway see more.
kubectl create -f kubernetes/kafka-pubsub-emulator-gateway-loadbalancer.yaml
The Pub/Sub Emulator Gateway server needs to be started with a
start command and address flag
to connect on Pub/Sub Emulator for Kafka.
- -a or --address: This is the address to point the REST gateway to pub/sub Emulator for Kafka (host:port).
- -p or --port: Specifies the application port default value is 8181.
- -c or --cert_file_path: Path to the certificate chain file to connect on Pub/Sub Emulator for Kafka.
- -h or --help: Help describe arguments
Provide Pub/Sub REST endpoints if you need a detailed information by each endpoint here.