fsprojects / FSharp.CloudAgent

Allows running F# Agents in a distributed manner using Azure Service Bus.
http://fsprojects.github.io/FSharp.CloudAgent/
The Unlicense
39 stars 14 forks source link

Support Topics and Subscriptions #6

Open AndyCross opened 9 years ago

AndyCross commented 9 years ago

Subscriptions are the bomb

In contrast to queues, in which each message is processed by a single consumer, topics and subscriptions provide a one-to-many form of communication, in a “publish/subscribe” pattern. Useful for scaling to very large numbers of recipients, each published message is made available to each subscription registered with the topic. Messages are sent to a topic and delivered to one or more associated subscriptions, depending on filter rules that can be set on a per-subscription basis. The subscriptions can use additional filters to restrict the messages that they want to receive. Messages are sent to a topic in the same way they are sent to a queue, but messages are not received from the topic directly. Instead, they are received from subscriptions. A topic subscription resembles a virtual queue that receives copies of the messages that are sent to the topic. Messages are received from a subscription identically to the way they are received from a queue.

By way of comparison, the message-sending functionality of a queue maps directly to a topic and its message-receiving functionality maps to a subscription

isaacabraham commented 9 years ago

This doesn't sound like it'll be too much work if the lower-level send/receive mechanisms are the same.

isaacabraham commented 9 years ago

@AndyCross can you have many receivers of a single subscription? so imagine you had ten instances of CloudAgent, would they need to each have a separate subscription to the topic or could they all receive on the same subscription?

AndyCross commented 9 years ago

They can all receive on the same subscription, the queueing semantics are the same. The magic is in the pubsub which happens behind the scenes before the subscription client tries to pop from the queue.

Addressing the correct subscription is often done algorithmically so you should probably just let consumers of cloud agent supply the subscription to read


From: Isaac Abrahammailto:notifications@github.com Sent: ý31/ý01/ý2015 16:00 To: isaacabraham/FSharp.CloudAgentmailto:FSharp.CloudAgent@noreply.github.com Cc: Andy Crossmailto:andy@elastacloud.com Subject: Re: [FSharp.CloudAgent] Support Topics and Subscriptions (#6)

@AndyCrosshttps://github.com/AndyCross can you have many receivers of a single subscription? so imagine you had ten instances of CloudAgent, would they need to each have a separate subscription to the topic or could they all receive on the same subscription?

— Reply to this email directly or view it on GitHubhttps://github.com/isaacabraham/FSharp.CloudAgent/issues/6#issuecomment-72323329.