I’ve been thinking about how I might use EventStore for command messaging with a multi-tenant application.
Given a stream per tenant, I’d like to have one consumer so that I have one writer for derived streams and I can utilize in-memory caches. At the same time I don’t want to have a single point of failure in the system for a given tenant.
The PreferDispatchToSingle option looks ideal for setting up fall-back consumers. The only question left in my mind for this usage is how do I define an order for fall back consumers?
I’m thinking I’d like to have 3 tenant streams and 3 consumers with fall-back redundancy distributed among them (eg. consumer-2 subscribed to stream-2 and also fallback for stream-1, etc.). The potential problem that I see here is – depending on which consumer is the preferred single – that I might be left with an uneven distribution of streams to consumers, in the extreme case a consumer that doesn’t see any messages.
Is there a simple way to achieve this, or any other approaches that I could consider?