EventStore / EventStoreDB-Client-Java

Official Asynchronous Java 8+ Client Library for EventStoreDB 20.6+
https://eventstore.com
Apache License 2.0
63 stars 20 forks source link

Create operation always enables projection, but it should not #259

Open michael-schnell opened 9 months ago

michael-schnell commented 9 months ago

Currently there seems to be no way to create a disabled projection using the EventStoreDBProjectionManagementClient.

The documentation of the create operation states:

Creates a new projection in the stopped state. Enable needs to be called separately to start the projection.

But when the following code is executed, the projection is already enabled (even if "enable" was not called afterwards):

    public static void main(String... args) throws ExecutionException, InterruptedException {

        EventStoreDBProjectionManagementClient client = EventStoreDBProjectionManagementClient
                .create(EventStoreDBConnectionString
                        .parseOrThrow("esdb://localhost:2113?tls=false"));

        String javascript = "fromAll().foreachStream().when({'one': function(state, ev) { linkTo('test-delete', ev); },'two': function(state, ev) { linkTo('test-delete', ev); }})";

        client.create("my-projection", javascript,
                CreateProjectionOptions.get().emitEnabled(false).trackEmittedStreams(true)).get();

    }

This means there is currently no way to create a disabled projection using the API.

Full Maven project for testing can be found here: https://github.com/michael-schnell/eventstore-create-enabled-bug

DEV-229

w1am commented 9 months ago

Right now, you can't do that with the gRPC client. But it will be amended.