How to subscribe to specific events changes

Hi everyone,

I’m wondering what’s the best way to subscribe to event changes with EventStore.

I mean, when a specific event appears on a stream, I need to start a saga.

Exemple : a new contact has been added. I need to start a saga to apply business processes.

I’ve used _connection.SubscribeToStreamAsync("$et- but I’m not sure if it’s reliable

Any advice?

Thanks for your help.

Patrice

That’s been reliable for me. Just store last event seen and reconnect on fail.

Why do you think it isn’t?

Thanks for your quick response!

When you say :

Just store last event seen and reconnect on fail.

You mean that’s the default behavior or should I follow this pattern ?

Why do you think it isn’t?

I’m just looking for the best approach and I’m a rookie with EventStore…so that’s why ^^

When you subscribe you specify starting event number. If you store this and just reconnect on fail using that number you start from last position.

Well, I use SubscribeToStreamAsync method from the .NET Event Store client library.
I cannot specify a starting event number. “Asynchronously subscribes to a single event stream. New events written to the stream while the subscription is active will be pushed to the client.”

Given that you are discussing sagas here (guessing it might actually be a process manager as the wording is often loose between the two) you likely should consider utilizing a persistent subscription as opposed to a catchupsubscription. This will allow for having multiple handlers/fault tolerance/etc.

Perfect.

Thanks you for taking the time to answer my question, both of you.