GithubHelp home page GithubHelp logo

klassmann / pubsub-push Goto Github PK

View Code? Open in Web Editor NEW
6.0 4.0 2.0 58 KB

Pull from Google PubSub and Push to a local endpoint

License: Apache License 2.0

Go 81.95% Makefile 18.05%
google-pubsub golang go cli tool http pubsub-push pubsub

pubsub-push's Introduction

pubsub-push

pubsub-push is a small utility for Pulling messages from a subscription in Google PubSub and redirect them as an HTTP POST to a local endpoint.

It is necessary because using the normal PubSub HTTP Push you need a public and a domain verified endpoint. Using this tool for development purposes you will be able to receive HTTP Push locally.

Installation

You can just download the latest binary from Releases tab and put it inside your PATH.

If you have a recent go installation, you can use:

$ go get github.com/klassmann/pubsub-push
$ go install github.com/klassmann/pubsub-push/cmd/pubsub-push

Usage

Before running, you have to set GOOGLE_APPLICATION_CREDENTIALS environment variable with the path of your service account key created with the correct Roles for getting messages from the desired subscription. See more here and here.

Example in Linux/Mac:

$ export GOOGLE_APPLICATION_CREDENTIALS=$HOME/project/key.json

After that you should run the following command with your configurations. These arguments are required:

$ pubsub-push -project gcloud-project -sub subscription_name -endpoint http://localhost

If you want to add some headers to request, you can use the -header option.

Note that -header can be used multiple times and you must use the format "key=value".

Adding headers:

$ pubsub-push -project proj-id -sub name -endpoint localhost -header "Content-type=application/json" -header "Auth-Key=my-secret-key"

Arguments

-project        The ID of your project inside Google Cloud Platform.
                    Eg: -project my-cloud-project

-sub            The subscription name, not including namespace, only the name.
                    Eg: -sub topic_sub

-endpoint       The complete URL, including schema, domain, port and the path.
                    Eg: -endpoint http://localhost:5000/services/sync

-header         A string like "key=value" for request headers. It can be used
                multiplem times.
                    Eg: -header "Content-type=application/json"

Requirements and Go version

It was built with go1.12.5 linux/amd64 and you can see dependencies inside go.mod.

License

Apache 2.0

pubsub-push's People

Contributors

klassmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

00mjk mlesaout

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.