Coder Social home page Coder Social logo

dataflow-grpc's Introduction

Example of calling gRPC from Beam pipelines

This pipeline resolves US Postal Zip Codes into a Zip/State/City.

Requests are received on Pub/Sub subscription as JSon payloads with a single zip attribute and the lookup results are output to a Google Cloud Storage Bucket in CSV format.

Setup environment and build artifact

  • export PROJECT_ID=<project where the buckets will be deployed>

  • Create the Pub/Sub subscription, output GCS bucket and other temporary buckets. The command below will run a Terraform script and set several variables to be used in other scripts

    source ./setup-env.sh

  • Build the gRPC artifacts and deploy to the local Maven repo

    (cd grpc-core && ./gradlew build publishToMavenLocal)

  • Build the gRPC server and deploy to the local Maven repo

    (cd grpc-server && ./gradlew build publishToMavenLocal)

  • Build (and test locally) the pipeline

    (cd pipeline && ./gradlew build)

Deploy the gRPC server to Cloud Run

Steps below will build a server's Docker image, deploy it to the Container Registry, deploy the image to Cloud Run and store the URL of the gRPC server in GRPC_HOST environment variable.

(cd grpc-server && ./deploy-to-cloud-run.sh && cd ..)

Capture the gRPC server hostname

export GRPC_HOST=$(grpc-server/get-server-hostname.sh)

Deploy the pipeline

(cd pipeline && ./run-pipeline.sh)

Run the request generation pipeline

This pipeline generates randomly generated JSON payloads based on this template. rate parameter defines the number of records per second.

./start-request-generation.sh <rate>

To test scaling of the main pipeline you can run multiple request pipelines.

dataflow-grpc's People

Contributors

slilichenko avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.