Skip to content

Discover core components through ServiceLoader providers - #528

Merged
rgoers merged 2 commits into
trunkfrom
feat/component-providers
Nov 9, 2026
Merged

rgoers merged 2 commits into
trunkfrom
feat/component-providers

Conversation

@ppkarwasz

Copy link
Copy Markdown
Member

flume-core hard-codes, in the *Type enums, the class names of components that live in other modules and repositories: e.g. SourceType.AVRO had to change for apache/logging-flume-rpc#24. This PR is the first step of replacing those enums with ServiceLoader providers, following the RpcClientProvider SPI of flume-sdk.

  • Adds the org.apache.flume.spi package: ComponentProvider, AbstractComponentProvider, ComponentRegistry and one provider interface per component kind (SourceProvider, SinkProvider, ChannelProvider, ChannelSelectorProvider, SinkProcessorProvider, ConfigFilterProvider, InterceptorProvider, EventSerializerProvider, EventDeserializerProvider, PathManagerProvider).
  • Registers the components of flume-core through nested Provider classes annotated with @ServiceProvider.
  • Makes the factories resolve type in this order: registered alias (case-insensitive), legacy enum alias, fully qualified class name of the component. Conflicting registrations only fail when the ambiguous type is used, and a broken provider is skipped.

The enums stay as a fallback, so existing configurations keep working.

Next steps

  1. Register providers in the other modules of this repository (taildir, syslog, netcat UDP, file and spillable channels, config filters, file channel encryption).
  2. Register providers in logging-flume-rpc and the other component repositories.
  3. Remove the *Type enums, the legacy-alias constructor and the unused *ConfigurationType layer, whose configuration classes do not exist.

🤖 Generated with Claude Code

`flume-core` hard-codes the class names of components that live in other modules and repositories, so moving a component requires a change in core. Each module can now register short `type` aliases through the `org.apache.flume.spi` provider interfaces. The `*Type` enums remain as a fallback until all modules register their providers.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Configuration filter modules should only depend on the API module, not on `flume-core`.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@rgoers
rgoers merged commit 1c75eab into trunk Nov 9, 2026
12 checks passed
@rgoers
rgoers deleted the feat/component-providers branch November 9, 2026 21:30
ppkarwasz added a commit that referenced this pull request Nov 9, 2026
The exported component packages reference it, so bnd rejects the build since #528 and #532 were both merged.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
ppkarwasz added a commit that referenced this pull request Nov 9, 2026
…529)

* Register the components of the other modules through `ServiceLoader`

Each module now registers its own `type` aliases, so `flume-core` no longer needs to know their class names.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>

* Export the `org.apache.flume.spi` package

The exported component packages reference it, so bnd rejects the build since #528 and #532 were both merged.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants