lundi 14 septembre 2020

pubsub model - Publisher broadcasting to remote subscribers

With a single publisher and multiple subscribers on same machine, below message hub help create pubsub model:

type PublisherHub struct { 
  subscribers map[*subscribmediator.Subscription]struct{} // each subscriber is local to same machine
  Register    chan *subscriptionmediator.Subscription // register a subscriber
  Unregister  chan *subscriptionmediator.Subscription
  Broadcast   chan *data // broadcast data to all subscribers
}

Language used is GoLang. Environment is Linux.

If a subscriber is sitting remote to publisher and does not use http protocol, then,

does pubsub pattern still a relevant pattern to use? with publisher on one machine & each subscriber on a different machine....

If no, what is the alternate design pattern?

Aucun commentaire:

Enregistrer un commentaire