Projection detect changes

Hello dear

I’m trying to list custom projection that have been created. Is there a way to list the definition.

So what i’m trying to do is to detect if a change has been made. I generate the projection using c# code and want to check if the existing projection has been changed and if has been change update the projection…

So far it seems the projection sdk only list the existing projection but not list the existing javascript implementation


Not directly answering your question, but we had a similar problem and couldn’t work out how to detect a change either, so in our release package we included the new projection. When we deployed to the Evenstore, if a file is detected, we simply update the projection.
It’s moving the problem to the deployment package building, rather than trying to make the Evenstore assist.

So, the short version of that. Only include the projection in your release if there is a change.


do you what is the different between a projection result and state? At the moment I’m using result…

I am not entirely sure.
My guess is result is a further transformation performed on your state (so the the output from transformBy)

I remember doing it once with the TCP client, and it worked just fine. I was getting the source code of the existing projection, then comparing it with the current version and replacing it if necessary. I will check if I can find the code.

do you have an example with the grpc client? I can list the projection but not the source code

It doesn’t seem possible with gRPC client, looking at the API surface. You can only get the status object, not the projection itself.

With the TCP client the code was:

    var query = await projectionsManager.GetQueryAsync(projection.Name, credentials);
    if (query != projection.Query)
        Log.Info("Projection {Name} exist but the query has changed, updating", projection.Name);
        await projectionsManager.UpdateQueryAsync(projection.Name, projection.Query, credentials);
        Log.Info("Projection {Name} is up to date", projection.Name);
catch (ProjectionCommandFailedException e) when (e.HttpStatusCode == 404)
    Log.Info("Projection {Name} doesn't exist, creating", projection.Name);
    await projectionsManager.CreateContinuousAsync(projection.Name, projection.Query, credentials);