kafka-pubsub

command module
v0.0.0-...-5f7a64d Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: MIT Imports: 12 Imported by: 0

README

Kafka Pubsub using Watermill Library

An example of implementing an event-driven application using pubsub pattern with Kafka as the message broker and Watermill framework.

Overview

This sample code is basically based on the Kafka example found in the Watermill project. Other than the following differences, the sample code is similar to the Watermill Kafka example:

  • Uses bitnami Kafka and Zookeeper docker images instead of Confluence docker images.
  • The go program runs outside of Docker network, hence the broker URL points to localhost.
  • Run the processors for sending and receiving Kafka messages as goroutines.

Setup

  1. Run Kafka and Zookeeper.

    $ docker-compose up
    
  2. Run the go program.

    $ go run main.go
    
  3. Terminate the programs.

    $ # Press CTRL-C to terminate the go program
    $ # Next shutdown kafka and zookeeper
    $ docker-compose down
    
  4. Alternatively, you can run everything with just 2 commands.

    $ make
    $ make teardown    # Run this to remove the containers
    

Reference and Credits

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