gopubsub

command module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2019 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Go Pub/Sub UI

Go Report Card

This tool eases debugging Google Clouds Pub/Sub with a simple UI.

Features include:

  • Subscription to given topics
  • Automatic creation of non-existent topics or subscriptions
  • Publishing messages from UI to configured topics
  • Configurable pre-defined payloads per topic
  • Live update of received messages
  • Multi-projects

Screenshot

Configuration

Following environment variables may be set:

Variable  Usage  Default value
GOPUBSUB_CONFIG Config file path config.yaml
GOPUBSUB_PORT Listening HTTP port 8080
GOPUBSUB_MAX_MESSAGES Only keep last n messages per topic 10
GOOGLE_APPLICATION_CREDENTIALS Path to JSON credentials file none
PUBSUB_EMULATOR_HOST Host of emulator (see below) none
GOOGLE_CLOUD_PROJECT Default project name default-project
The config.yaml file

To get GoPubSub working, you'll need to create config.yaml file with your topics and subscriptions info:

topics:
  -
    name: my-topic
    project: my-gcp-project
    subscription: my-subscription
  -
    name: my-other-topic
    project: other-gcp-project
    subscription: my-other-subscription
    payloads:
      -
        name: hello
        payload: |
          {"hello": "world"}
      -
        name: hello-again
        payload: |
          {"hello": "world again"}
  -
    name: my-last-topic

Note that all non-existant topic or subscription will be created. If no subscription is given for a topic, it will be created as sub-<topic-name>.

Usage

Using binary

Download latest release for your OS from the releases page, or run:

go get -u github.com/clickandmortar/gopubsub

Then:

export GOPUBSUB_CONFIG="/path/to/config.yaml"

# To use local emulator
export PUBSUB_EMULATOR_HOST=localhost:8085

# To use actual Pub/Sub service
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/application_default_credentials.json"

gopubsub

And open http://localhost:8080.

Using Docker image
docker pull clickandmortar/gopubsub
docker run -d \
 -v $(pwd)/config.yaml:/go/src/app/config.yaml \
 -p 8080:8080 \
 --name="gopubsub" \
 -e PUBSUB_EMULATOR_HOST=pubsub:8085 \
 clickandmortar/gopubsub
With docker-compose
docker-compose up -d
From source
go run main.go

Build

Binaries
make

Linux and macOS (Darwin) binaries will be available under the bin/ directory.

Docker image
make docker

Improvements

  • Remove initial AJAX call
  • Output message attributes
  • Use Vue.js for form
  • Fetch available topics list
  • Multi-project compatibility
  • Live update (using SSE)
  • JSON pretty-printing
  • Working message publication
  • Samples for message publication

Credits

This app is heavily inspired by Google's sample.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址