Restarting faulted projections via C#?

We have a continuous projection in our ES which faulted and as a result brought down part of our system. To try and ensure our projections do not lay in this state until someone notices an issue with the system can you tell me if it’s possible to check the state of projections and restart any that are faulted via the C# API?

Why did the projection get into a faulted state? do you have any logs that would indicate the reason?
It’s also entirely possible to check the state of all the projections via the [ProjectionManager](https://github.com/EventStore/EventStore/blob/release-v4.0.0/src/EventStore.ClientAPI/Projections/ProjectionsManager.cs#L136) which is included in the ClientAPI.

Look at ProjectionsManager
https://github.com/EventStore/EventStore/blob/release-v4.0.0/src/EventStore.ClientAPI/Projections/ProjectionsManager.cs#L189

also if you prefer other tooling (scripting etc) and are on a
commercial package see the cli.

Thanks Pieter & Greg for the quick responses, will take a look at the ProjectionManager.

I am interested in knowing why the projection faulted. Would you be willing to share why that happened? What version of Event Store are you running?

Pieter,

We are using 3.9.2.0. I will try get some log data but its on a box I don’t have access to so might not be able to get it :frowning:

Re the ProjectionManager: When I call GetStatusAsync what are the values that can be returned within the status property i.e. Running, Stopped, Faulted etc? Also, if I call to EnableAsync on a faulted projection will this Reset and Start the projection?

Can anyone provide assistance with my following queries:

Re the ProjectionManager: When I call GetStatusAsync what are the values that can be returned within the status property i.e. Running, Stopped, Faulted etc? Also, if I call to EnableAsync on a faulted projection will this Reset and Start the projection?

Also, in order to test my new code is what is the easiest way to force a projection into a faulted state?

In your projection: throw "I am now in a faulted state"