CreateContinuousAsync - no emitEnabled option

Hello Community!

There is no way to set emitEnabled to true in the CreateContinuousAsync method. Additionally - not in accordance with its name - the method not only creates, but also starts the projection. Only the UpdateAsync method has the emitEnabled option. So, to create and run a projection with emitEnabled == true, you need to create a “do nothing” projection and update it later. Is this the recommended way?

var nonExistentStreamName = Guid.NewGuid();
var doNothingBody = "fromStream('"+nonExistentStreamName+"').when({foo: function(state, event){}})";               
projectionManagementClient.CreateContinuousAsync(projectionName, doNothingBody).Wait();
projectionManagementClient.UpdateAsync(projectionName, originalBody, emitEnabled: true).Wait();

Hi @invenisso,

The CreateContinuousAsync method sets the EmitEnabled option to true.

So you should be able to just create the projection with no need to perform further updates, unless you wanted to explicitly disable EmitEnabled.

There are some discrepancies between the Client API and the HTTP API for projections, which are detailed in this issue here:

Unfortunately, I checked again just to be sure - emit enabled is set to false by default. So a workaround is still necessary. I am using the nuget 20.6.0 package.

Sorry, my previous answer was to do with the TCP clientAPI.

Are you using the dotnet gRPC client?

If so, then this is still an issue and at the moment the only workaround is to update the projection as you are doing now. You can track the progress of this issue on github here:

Yes, I’m using gRPC client. Ok, I will track progress of this issue on github.
Thank you for answer.