worker-demo

command module
v0.0.0-...-ea17066 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 1 Imported by: 0

README

Yokai Worker Demo

Go version

Demo application working with Pub/Sub, based on the Yokai Go framework.

Overview

This demo application is a simple subscriber to Pub/Sub.

It provides:

  • a Yokai application container, with the worker module to offer a worker subscribing to Pub/Sub (using the fxgcppubsub contrib module)
  • a Pub/Sub emulator container, with preconfigured topic and subscription
  • a Pub/Sub emulator UI container, preconfigured to work with the emulator container
  • a Jaeger container to collect the application traces
Layout

This demo application is following the recommended project layout:

  • cmd/: entry points
  • configs/: configuration files
  • internal/:
    • worker/: workers
    • bootstrap.go: bootstrap
    • register.go: dependencies registration
Makefile

This demo application provides a Makefile:

make up     # start the docker compose stack
make down   # stop the docker compose stack
make logs   # stream the docker compose stack logs
make fresh  # refresh the docker compose stack
make test   # run tests
make lint   # run linter

Usage

Start the application

To start the application, simply run:

make fresh

After a short moment, the application will offer:

Message publication

You can use the Pub/Sub emulator UI to publish a message to the preconfigured topic:

http://localhost:8680/project/demo-project/topic/demo-topic

Message subscription

Check your application logs by running:

make logs

You will see the SubscribeWorker subscribed to Pub/Sub in action, logging the received messages.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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