Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
michael-schnell opened this issue Dec 31, 2023 · 3 comments
Closed
Labels
linear wontfix This will not be worked on

Comments

@michael-schnell
Copy link

michael-schnell commented Dec 31, 2023

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 w1am added the linear label Jan 5, 2024
@w1am
Copy link
Contributor

w1am commented Jan 10, 2024

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

@michael-schnell
Copy link
Author

Any update here?

@YoEight
Copy link
Member

YoEight commented Apr 7, 2025

Let me rephrase what @w1am mentioned. The client uses the gRPC protocol, which, as of now, doesn’t provide a way to disable a projection on creation. This isn’t a Java-specific client — it’s simply a gRPC-based one. Currently, the only API that supports it is the projection REST API, which the Java client does not use.

We have no plans to support a hybrid client, especially for the projections API. However, we do intend to release a dedicated tool that will cover this need, including support for the user management API. Unfortunately, I don't have an ETA for that.

In your case, using the projection REST API directly would be the better approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants