pubsub

command module
v0.0.0-...-82d4b34 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 9 Imported by: 0

README

Message PubSub example

This example demonstrates publish/subscribe messaging pattern using Redis implementation of IMessageBus in yaaf-common package. The example initializes one publisher publishing messages to a topic and two subscribers processing these messages

PubSub Messaging pattern

In a publish/subscribe pattern, many publishers can publish a message to a topic (channel) and many subscribers can subscribe to a topic and process messages. In this pattern the same message can be processed multiple times. Every subscriber subscribed to the same topic will get the message and can process it.

In this example we will create a subscriber sending status messages and two subscribers will process the messages:

  • one subscriber prints the values
  • second subscriber generate aggregated values per time window
flowchart LR
   p1(Publisher) --> q1[[status topic]]
   q1[[status topic]] --> c1(Status Logger)
   q1[[status topic]] --> c2(Status Aggregator)

To run this example:

go run .

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