treating a stream as a queue


I’m designing part of a system and I want to use eventstore rather than a message queue to allow a REST api to communicate with a backend process.

In this case, can I use ExpectedVersion.Any all the time, as the specific event version or order that is written aren’t important—all I’m concerned about is that the event gets added to the queue, or should I be taking the version in to
account and doing a conditional write?

If the latter, when a conditional write fails with a version mismatch, is there a way other than reading the last event ot get the version—i.e is it returned in the ConditionalWriteResult structure?

Any help appreciated.

Kind regards


For your “queue” did you know there is competing consumers over http?

In terms of how you are writing EV.Any is likely good enough (providing any retries are done quickly as they will be idempotent).

Hi Greg,

Thanks. I’m using competing consumers to read the queue.

If I am writing to a stream modelling an aggregate in the domain driven design sense and am using a conditional write that fails with a version mismatch, does the next version field still give the
expected version or should I keep track of this myself but reading the last event of the stream?



On Behalf Of Greg Young