Publisher-Subscriber Example With Redis
This repository contains a simple example of a publisher-subscriber pattern implemented in Go. The publisher sends messages, and the subscriber receives and processes them accordingly.
-
Clone Repository:
git clone https://github.com/primayudantra/example-go-redis-pubsub.git
-
Navigate to Publisher Directory:
cd example-go-redis-pubsub/publisher
-
Run Publisher:
go run publisher.go
This command will start the publisher, which will begin sending messages.
-
Open a New Terminal Window/Tab:
-
Navigate to Subscriber Directory:
cd ../subscriber
-
Run Subscriber:
go run subscriber.go
This command will start the subscriber, which will begin receiving and processing messages sent by the publisher.
- The publisher and subscriber are implemented in separate Go files (
publisher.go
andsubscriber.go
) located in their respective directories. - Ensure that Go is installed on your system and properly configured.
- The publisher and subscriber are designed to communicate locally. However, you can modify the code to support communication over a network if needed.
- Feel free to explore and modify the code to fit your requirements. This example serves as a basic demonstration of the publisher-subscriber pattern in Go.
- Go programming language (Golang) installed on your system.
- Redis (Installation instruction here
Prima Yudantra - Github