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

Split loading plugin arguments from the Application Context #3615

Conversation

dlvenable
Copy link
Member

Description

When working on #3595, I found that adding a new type directly from the Application Context into a Data Prepper plugin constructor requires quite a few code touches. Not only that, but it becomes hard to test new types like CircuitBreaker that are optional and can be null.

This PR splits the work for getting instances from the Application Context into a new class - ApplicationContextToTypedSuppliers. Any type that is just passed directly can use this mechanisms.

Some classes remain in DefaultPluginFactory because there is additional logic within the plugin framework for them. For example, they are special arguments per-plugin, or additional work is performed from them (e.g. BeanFactory and PluginConfigurationObservableFactory).

Issues Resolved

N/A

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…s for providing arguments from the Application Context to plugin parameters.

Signed-off-by: David Venable <[email protected]>
@dlvenable dlvenable force-pushed the improve-plugin-context-from-application-context branch from c24d189 to c09e0f6 Compare November 9, 2023 03:45
private final PluginConfigurationObservableFactory pluginConfigurationObservableFactory;
private final CircuitBreaker circuitBreaker;
private final ApplicationContextToTypedSuppliers applicationContextToTypedSuppliers;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we use interface instead of implementation here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an internal class that I don't think needs to be split. We could do later if we found a need, but at this point I think just the class is ok.

@dlvenable dlvenable merged commit b5bc0e5 into opensearch-project:main Nov 15, 2023
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants