Golang Microservices: Pub/Sub with Redis as Message Broker



Golang Microservices: Pub/Sub with Redis as Message Broker

Golang Microservices: Pub/Sub with Redis as Message Broker

Welcome! Let’s talk about Pub/Sub (Publisher/Subscriber) messaging paradigm, specifically about using Redis as a Message Broker for Publishing and Subscribing events, instead of using Kafka or RabbitMQ, Redis provides a light way to support messaging between different microservices:

* Publishers can push data to any channel
* Subscribers can listen to concrete channels as well as patterns

For Go, I recommend using the “github.com/go-redis/redis/v8” package, this allows you access Redis in a type-safe way.

RELEVANT LINKS

* Example code: https://github.com/MarioCarrion/todo-api-microservice-example/tree/cf94b77512b88d347ad55428436f6a515f8caaeb
* Blog: https://mariocarrion.com/2021/06/10/golang-microservices-pub-sub-redis.html

* “Building Microservices in Go: Events Streaming using Apache Kafka”: https://youtu.be/jr7OULxYm0A
* “Building Microservices in Go: Events and Background Jobs using RabbitMQ”: https://youtu.be/L0yJxCKrkIY

* Playlist “Learning Golang”: https://www.youtube.com/playlist?list=PL7yAAGMOat_F7bOImcjx4ZnCtfyNEqzCy
* Playlist “Building Microservices in Go/Golang”: https://www.youtube.com/playlist?list=PL7yAAGMOat_Fn8sAXIk0WyBfK_sT1pohu
* Playlist “Golang Tools and Packages”: https://www.youtube.com/playlist?list=PL7yAAGMOat_HEEOvH99agDs_5g51A0Ls3
* Playlist “Testing in Go”: https://www.youtube.com/playlist?list=PL7yAAGMOat_HSeW4zF0uRL9EaHadE4ZZq

00:00 Start
00:12 What is Redis? — link
00:35 Redis as Pub/Sub
01:55 Demo Redis and Golang
06:29 Conclusion

Who am I:

HelloπŸ‘‹πŸΌ! I’m Mario, a Hands-on Software Architect and Lead Backend Engineer with more than 16 years of professional experience building all kinds of software including on-premise Industrial Automation Systems, Linux Accessibility Desktop and Browser Components as well as Distributed Advertising Microservices.

Every week I will share with you different topics I’ve learned while working for small startups and large companies including the processes I’ve followed over the years for successfully delivering complex enterprise systems from start to end.

Subscribe if you like Software Development, Software Architecture and Systems Design!

Keep it up. Don’t give up!

#golang #microservices #programming

— Our affiliate links below

Shop our favorite products β†’ https://www.amazon.com/shop/rubycarrion
Vlogging setup β†’ https://rubycarrion.com/camerasforvlogging/
Get a 30 day FREE trial of Epidemic Sound β†’ https://www.epidemicsound.com/referral/szx441/
Try Amazon Prime 30-Day FREE trial β†’ https://amzn.to/3s0el1R
I love getting Cash Back and think you will too! Join for free and get $20 when you spend $20 β†’ https://www.rakuten.com/r/RUBYRA132?eeid=28187
Sign up to start using vidIQ to grow your YouTube channel for FREE β†’ https://vidiq.com/rubycarrion

— Our Vlog Channel

https://www.youtube.com/c/RubyCarrion/videos

Comments are closed.