You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2024/04/29 03:19:47 UTC

(logging-flume-spring-boot) branch main updated: Provide method to create ChannelSelector

This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-flume-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new bc3ad08  Provide method to create ChannelSelector
bc3ad08 is described below

commit bc3ad080d17bbcf8625db088fe4166153868a573
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Sun Apr 28 20:19:40 2024 -0700

    Provide method to create ChannelSelector
---
 .../apache/flume/spring/boot/config/AbstractFlumeConfiguration.java   | 2 ++
 .../src/test/java/org/apache/flume/spring/app/config/AppConfig.java   | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/flume-spring-boot/src/main/java/org/apache/flume/spring/boot/config/AbstractFlumeConfiguration.java b/flume-spring-boot/src/main/java/org/apache/flume/spring/boot/config/AbstractFlumeConfiguration.java
index 79db452..827ba91 100644
--- a/flume-spring-boot/src/main/java/org/apache/flume/spring/boot/config/AbstractFlumeConfiguration.java
+++ b/flume-spring-boot/src/main/java/org/apache/flume/spring/boot/config/AbstractFlumeConfiguration.java
@@ -106,6 +106,7 @@ public abstract class AbstractFlumeConfiguration {
   }
 
   protected ChannelSelector createChannelSelector(Class<? extends ChannelSelector> clazz,
+                                                  List<Channel> channels,
                                                   Map<String, String> params) {
     ChannelSelector selector;
     try {
@@ -113,6 +114,7 @@ public abstract class AbstractFlumeConfiguration {
     } catch (Exception ex) {
       throw new FlumeException("Unable to create channel selector " + clazz.getName(), ex);
     }
+    selector.setChannels(channels);
     Configurables.configure(selector, createContext(params));
     return selector;
   }
diff --git a/flume-spring-boot/src/test/java/org/apache/flume/spring/app/config/AppConfig.java b/flume-spring-boot/src/test/java/org/apache/flume/spring/app/config/AppConfig.java
index 0f1bc2b..f0ad299 100644
--- a/flume-spring-boot/src/test/java/org/apache/flume/spring/app/config/AppConfig.java
+++ b/flume-spring-boot/src/test/java/org/apache/flume/spring/app/config/AppConfig.java
@@ -61,8 +61,8 @@ public class AppConfig extends AbstractFlumeConfiguration {
 
   @Bean
   public SourceRunner seqSource(Channel memoryChannel, Map<String, String> source1Properties) {
-    ChannelSelector selector = new ReplicatingChannelSelector();
-    selector.setChannels(listOf(memoryChannel));
+    ChannelSelector selector = createChannelSelector(ReplicatingChannelSelector.class, listOf(memoryChannel),
+            null);
     return configureSource("source1", SequenceGeneratorSource.class, selector,
         source1Properties);
   }