0

I'm looking for a scalable pub sub cluster where it's possible that publishers only send messages for a given topic to socketcluster if there are subscribers?

The reason being is that all of my publishers process millions of messages for many topics which for long periods won't have subscribers. So it's a huge waste computationally and price wise to send everything to the pub sub cluster.

Fachtna Simi
  • 437
  • 2
  • 13

1 Answers1

1

PubSub is designed to decouple the subscribers and the publisher. So, your request is an anti-pattern of PubSub.

Anyway, if you publish a message into PubSub and there isn't subscription (I said "subsciprions" not "subscriber"), the message is dropped. Your publishers can still check if a subscription exists on a topic before processing the messages. Subscribers check isn't possible.

If there is one (or many) subscription, the message is send to it (if several subscription, the message is duplicated). The message are kept up to 7 days in the subscription, but you can reduce this duration according with your use case. by the way, when a subscriber will listen the subscription, it will be able to only receives and processes the relevant message, not the too old ones.

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76
  • Thanks. I guess what I'm looking for then is a pub-sub framework where the publishers can be notified when subscriptions start/cease for topics. So if a consumer subscribes to topic A, an event is sent out to the publishers. – Fachtna Simi Jul 14 '20 at 17:04