Skip to content

DistributedPubSub: add a wait-for-subscribers value to Publish commands to delay publishing / discarding until subscribers are available #7627

@Aaronontheweb

Description

@Aaronontheweb

Is your feature request related to a problem? Please describe.

A common problem that occurs with DistributedPubSub is when both the publisher and the subscriber start at essentially the same time, but on different nodes, and it takes a moment for that subscription to replicate. You end up with an immediate DeadLetter per #7626 and the publisher is never notified that this happened unless the end-user implements their own explicit ACK-reply system from all subscribers.

This makes DistributedPubSub kind of unwieldy to use in cases that require a higher degree of consistency.

Describe the solution you'd like

I think it would be worth doing two things:

  1. Create a new PublishWithAck message that sends a reply back to the publisher, letting them know that the message was sent to N nodes with subscribers. That way the publisher can get feedback on whether or not their message was actually delivered to someone without having to write infrastructure to do this themselves in the subscriber actors.
  2. Create a new WaitForSubscribers value - we shouldn't let the user do stuff like specifying the number of subscribers because users will 100% interpret that to mean "the number of subscribers" and not the "number of nodes with subscribers," the latter being what we actually can measure. This should also have a timeout property to prevent memory build up and the DistributedPubSub should have a max-buffer-size setting for the number of "waiting" messages it will allow per-topic.

Describe alternatives you've considered

The alternatives are forcing the user to do all of this themselves via the queries we added to support #3663 - which is very high-boilerplate, janky, and generally not good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDeveloper experience issues - papercuts, footguns, and other non-bug problems.akka-cluster-toolsdiscussion

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions