Skip to content

Commit bf19bb6

Browse files
rgoersppkarwaszCopilot
authored
Spring boot4 (#460)
* Add RoutableProxyChannelSelector and allow Interceptors to be configured in Spring Boot * Enhancements for Spring Boot * Add relative path * Drop LGPL spotbugs-annotations in favor of internal annotation SpotBugs honors any annotation whose simple name is SuppressFBWarnings, so a tiny internal annotation lets us avoid shipping a build dependency on the LGPL-licensed spotbugs-annotations artifact. Assisted-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Fix formatting * Fix potential NPE --------- Co-authored-by: Piotr P. Karwasz <pkarwasz-github@apache.org> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 432a259 commit bf19bb6

24 files changed

Lines changed: 870 additions & 447 deletions

File tree

flume-bom/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838
<flume-jms.version>2.0.0-SNAPSHOT</flume-jms.version>
3939
<flume-kafka.version>2.0.0-SNAPSHOT</flume-kafka.version>
4040
<flume-scribe.version>2.0.0-SNAPSHOT</flume-scribe.version>
41-
<flume-spring-boot.version>2.0.0-SNAPSHOT</flume-spring-boot.version>
41+
<flume-spring-boot.version>2.1.0-SNAPSHOT</flume-spring-boot.version>
4242
<flume-taildir.version>2.0.0-SNAPSHOT</flume-taildir.version>
4343
<flume-tools.version>2.0.0-SNAPSHOT</flume-tools.version>
4444
<flume-legacy.version>2.0.0-SNAPSHOT</flume-legacy.version>
45-
<flume-morphline.version>2.0.0-SNAPSHOT</flume-morphline.version>
45+
<flume-rpc.version>2.0.0-SNAPSHOT</flume-rpc.version>
4646
</properties>
4747

4848
<dependencyManagement>
@@ -105,12 +105,12 @@
105105
<dependency>
106106
<groupId>org.apache.flume</groupId>
107107
<artifactId>flume-rpc-avro</artifactId>
108-
<version>${project.version}</version>
108+
<version>${flume-rpc.version}</version>
109109
</dependency>
110110
<dependency>
111111
<groupId>org.apache.flume</groupId>
112112
<artifactId>flume-rpc-thrift</artifactId>
113-
<version>${project.version}</version>
113+
<version>${flume-rpc.version}</version>
114114
</dependency>
115115
<dependency>
116116
<groupId>org.apache.flume</groupId>

flume-ng-channels/flume-file-channel/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@
121121
<dependency>
122122
<groupId>com.google.code.findbugs</groupId>
123123
<artifactId>jsr305</artifactId>
124-
<version>${jsr305.version}</version>
125124
<scope>provided</scope>
126125
</dependency>
127126

flume-ng-configuration/src/main/java/org/apache/flume/conf/FlumeConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import org.apache.flume.conf.channel.ChannelType;
6262
import org.apache.flume.conf.configfilter.ConfigFilterConfiguration;
6363
import org.apache.flume.conf.configfilter.ConfigFilterType;
64+
import org.apache.flume.conf.internal.SuppressFBWarnings;
6465
import org.apache.flume.conf.sink.SinkConfiguration;
6566
import org.apache.flume.conf.sink.SinkGroupConfiguration;
6667
import org.apache.flume.conf.sink.SinkType;
@@ -83,6 +84,7 @@
8384
* @see org.apache.flume.node.ConfigurationProvider
8485
*
8586
*/
87+
@SuppressFBWarnings(value = {"EI_EXPOSE_REP"})
8688
public class FlumeConfiguration {
8789

8890
private static final Logger logger = LogManager.getLogger();

flume-ng-configuration/src/main/java/org/apache/flume/conf/channel/ChannelSelectorType.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ public enum ChannelSelectorType implements ComponentWithClassName {
4141
/**
4242
* Multiplexing channel selector.
4343
*/
44-
MULTIPLEXING("org.apache.flume.channel.MultiplexingChannelSelector");
44+
MULTIPLEXING("org.apache.flume.channel.MultiplexingChannelSelector"),
45+
/**
46+
* Routable proxy channel selector.
47+
*/
48+
ROUTABLE_PROXY("org.apache.flume.channel.RoutableProxyChannelSelector");
4549

4650
private final String channelSelectorClassName;
4751

flume-ng-configuration/src/main/java/org/apache/flume/conf/channel/ChannelType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ public enum ChannelType implements ComponentWithClassName {
4646
*/
4747
JDBC("org.apache.flume.channel.jdbc.JdbcChannel"),
4848

49+
/**
50+
* Kafka channel.
51+
*/
52+
KAFKA("org.apache.flume.channel.kafka.KafkaChannel"),
53+
4954
/**
5055
* Spillable Memory channel
5156
*
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to you under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.flume.conf.internal;
18+
19+
import java.lang.annotation.ElementType;
20+
import java.lang.annotation.Retention;
21+
import java.lang.annotation.RetentionPolicy;
22+
import java.lang.annotation.Target;
23+
24+
/**
25+
* Used to suppress SpotBugs warnings in Flume artifacts.
26+
*
27+
* <p>SpotBugs recognizes any annotation whose simple name is {@code SuppressFBWarnings}, so this
28+
* type lets us drop the dependency on the LGPL-licensed {@code spotbugs-annotations} artifact.</p>
29+
*
30+
* <p>This type is not exported via JPMS. Do <strong>not</strong> use in third-party modules.</p>
31+
*/
32+
@Retention(RetentionPolicy.CLASS)
33+
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.PARAMETER})
34+
public @interface SuppressFBWarnings {
35+
36+
/** The set of SpotBugs warnings to suppress. */
37+
String[] value() default {};
38+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to you under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
/**
18+
* Contains types used only by Flume modules.
19+
*
20+
* <p>These types are not exported via JPMS and are not available to third-party modules.</p>
21+
*/
22+
package org.apache.flume.conf.internal;

flume-ng-core/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
<dependency>
9090
<groupId>com.google.code.findbugs</groupId>
9191
<artifactId>jsr305</artifactId>
92-
<version>${jsr305.version}</version>
9392
<scope>provided</scope>
9493
</dependency>
9594

flume-ng-core/src/main/java/org/apache/flume/channel/ChannelProcessor.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,15 @@ public class ChannelProcessor implements Configurable {
5555
private final InterceptorChain interceptorChain;
5656

5757
public ChannelProcessor(ChannelSelector selector) {
58+
this(selector, null);
59+
}
60+
61+
public ChannelProcessor(ChannelSelector selector, List<Interceptor> interceptors) {
5862
this.selector = selector;
5963
this.interceptorChain = new InterceptorChain();
64+
if (interceptors != null) {
65+
interceptorChain.setInterceptors(interceptors);
66+
}
6067
}
6168

6269
public void initialize() {

flume-ng-core/src/main/java/org/apache/flume/channel/LoadBalancingChannelSelector.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.flume.Channel;
2626
import org.apache.flume.Context;
2727
import org.apache.flume.Event;
28+
import org.apache.flume.conf.internal.SuppressFBWarnings;
2829

2930
/**
3031
* Load balancing channel selector. This selector allows for load balancing
@@ -39,6 +40,7 @@
3940
* defaults to <tt>ROUND_ROBIN</tt> type, but can be overridden via
4041
* configuration.</p>
4142
*/
43+
@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
4244
public class LoadBalancingChannelSelector extends AbstractChannelSelector {
4345
private final List<Channel> emptyList = Collections.emptyList();
4446
private ChannelPicker picker;

0 commit comments

Comments
 (0)