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

Combine File data source and Streaming data source #34

Open
asaha123 opened this issue Jul 15, 2021 · 2 comments
Open

Combine File data source and Streaming data source #34

asaha123 opened this issue Jul 15, 2021 · 2 comments
Labels

Comments

@asaha123
Copy link

asaha123 commented Jul 15, 2021

Is your feature request related to a problem? Please describe.

We are discussing a situation where the Java SDK - when it is starting up as part of an application is unable to communicate with launch darkly - perhaps a networking issue or an invalid SDK key. In this scenario, feature flag evaluations will use the default values - an undesirable situation for us.

Describe the solution you'd like

In the above situation, we would want it to startup initially bootstrapped from a file (i.e. the file data source) and then attempt to switch to the streaming behaviour. I have been taking a look at the code and i was wondering if the current code would allow me to somehow inject the datastore that was created when using the file data source when using the streaming data source. So something like (in pseudo-ish code):

# First read from files
    LDConfig config = new LDConfig.Builder()
            .dataSource(
                    FileData.dataSource()
                            .filePaths("file1.json", "file2.json")
                            .autoUpdate(true)
            )
            .events(Components.noEvents())
            .build();
    
    LDClient client = new LDClient("sdk key", config);

# Then, switch to the streaming data source with
config.DataSource = < existing data source above>
LDClient client = new LDClient("sdk key", config);

So, instead of overwriting the data in the second step, it performs only upsert operations.

Describe alternatives you've considered

We understand ld-relay can help us here, but we are considering the alternatives due to some specific concerns - unrelated to ld-relay itself.

Additional context
NA

@eli-darkly
Copy link

The current architecture doesn't allow switching horses in midstream like that. Something similar has been suggested in the past (either for this SDK or another one, I'm not sure) and we've considered it, but hadn't moved forward due to 1. a lack of demand and 2. some design questions that made it not quite as straightforward as you might think— the suggestion at that time was that both data sources would be in effect from the start, so that the file one could be used to provide flags that weren't coming from LD, but that raised questions of how to determine which one took priority.

In any case, with the current SDK the only workarounds I can think of to accomplish something like this would be fairly elaborate and probably brittle.

@asaha123
Copy link
Author

Thanks for sharing your thoughts.

the suggestion at that time was that both data sources would be in effect from the start, so that the file one could be used to provide flags that weren't coming from LD, but that raised questions of how to determine which one took priority.

My 2-cents on this would be something very naive where we could setup up a hierarchy of data sources where the one later in the hierarchy overrides the one before with the logic that only of them being available is considered enough for the datastore to have been initialised.

@tanderson-ld tanderson-ld transferred this issue from launchdarkly/java-server-sdk May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants