How hard could it be to take 1-1 communication with Go Channels and turn it into 1-many to enable fanout?
As hard as you want to make it! In this talk, i'll walk through the problem space, how I solved it, and demonstrate some code showing how simple (or not) it can be.
https://github.com/StabbyCutyou/spub
6. @StabbyCutyou
DEFINETHE PROBLEM - I WANT…
• To enable message fanout inside of a process
• To strictly stick to []byte as my message format
• To make it manage subscriptions
• To ensure the highest guarantee of deliverability that I can
7. @StabbyCutyou
DEFINETHE PROBLEM - I DON’T
WANT…
• To manage communicating between processes
• To worry about latency of the library itself
• To manage the durability of the messages in flight
• To manage message lifecycle
• To manage complex routing logic
34. @StabbyCutyou
I HAD 9 PROBLEMS
• Potential Starvation
• Timeliness
• ConfigurableTimeouts
• How to communicate Errors
• Specialized Broadcast Failures
• Enabling Retries
• Unsubscribing
• Graceful shutdown
• Unavoidable Panics
35. @StabbyCutyou
NIFTY BONUS PROBLEMS?
• Should the errors channel be buffered or not?
• And if so, 1 or >1?
• What if someone wants no timeouts at all?
• What if they want the lesser of the Publisher or Subscriber timeout?
• What if they want the greater of it?
• What if consumers try to close their channels?
• They definitely should not, but what if?