Package org.apache.flume

Examples of org.apache.flume.ChannelSelector


    if (!selectorType.equals(ChannelSelectorType.OTHER)) {
      selectorClassName = selectorType.getChannelSelectorClassName();
    }

    ChannelSelector selector = null;

    try {
      @SuppressWarnings("unchecked")
      Class<? extends ChannelSelector> selectorClass =
          (Class<? extends ChannelSelector>) Class.forName(selectorClassName);
View Full Code Here


    sink.configure(new Context(context));
    sink.setChannel(channel);
    sink.start();
   
    source = new EmbeddedSource(sink);   
    ChannelSelector rcs = new ReplicatingChannelSelector();
    rcs.setChannels(Collections.singletonList(channel));
    ChannelProcessor chp = new ChannelProcessor(rcs);
    Context chpContext = new Context();
    chpContext.put("interceptors", "uuidinterceptor");
    chpContext.put("interceptors.uuidinterceptor.type", UUIDInterceptor.Builder.class.getName());
    chp.configure(chpContext);
View Full Code Here

  private void configureSource() {
    List<Channel> channels = new ArrayList<Channel>();
    channels.add(ch);

    ChannelSelector rcs = new ReplicatingChannelSelector();
    rcs.setChannels(channels);

    source.setChannelProcessor(new ChannelProcessor(rcs));

    source.start();
  }
View Full Code Here

  private void configureSource() {
    List<Channel> channels = new ArrayList<Channel>();
    channels.add(channel);

    ChannelSelector rcs = new ReplicatingChannelSelector();
    rcs.setChannels(channels);

    source.setChannelProcessor(new ChannelProcessor(rcs));
  }
View Full Code Here

  public void testExceptionFromGetTransaction() {
    // create a channel which unexpectedly throws a ChEx on getTransaction()
    Channel ch = mock(Channel.class);
    when(ch.getTransaction()).thenThrow(new ChannelException("doh!"));

    ChannelSelector sel = new ReplicatingChannelSelector();
    sel.setChannels(Lists.newArrayList(ch));
    ChannelProcessor proc = new ChannelProcessor(sel);

    List<Event> events = Lists.newArrayList();
    events.add(EventBuilder.withBody("event 1", Charsets.UTF_8));
View Full Code Here

  public void testNullFromGetTransaction() {
    // channel which returns null from getTransaction()
    Channel ch = mock(Channel.class);
    when(ch.getTransaction()).thenReturn(null);

    ChannelSelector sel = new ReplicatingChannelSelector();
    sel.setChannels(Lists.newArrayList(ch));
    ChannelProcessor proc = new ChannelProcessor(sel);

    List<Event> events = Lists.newArrayList();
    events.add(EventBuilder.withBody("event 1", Charsets.UTF_8));
View Full Code Here

    Configurables.configure(channel, new Context());

    List<Channel> channels = new ArrayList<Channel>();
    channels.add(channel);

    ChannelSelector rcs = new ReplicatingChannelSelector();
    rcs.setChannels(channels);

    source.setChannelProcessor(new ChannelProcessor(rcs));
  }
View Full Code Here

        }

        ChannelSelectorConfiguration selectorConfig =
            config.getSelectorConfiguration();

        ChannelSelector selector = ChannelSelectorFactory.create(
            channels, selectorConfig);

        ChannelProcessor channelProcessor = new ChannelProcessor(selector);
        Configurables.configure(channelProcessor, config);

        source.setChannelProcessor(channelProcessor);
        conf.getSourceRunners().put(comp.getComponentName(),
            SourceRunner.forSource(source));
      }
    }
    Map<String, Context> sourceContexts = agentConf.getSourceContext();

    for (String src : sources) {
      Context context = sourceContexts.get(src);
      if(context != null){
        Source source =
            getSourceFactory().create(src,
                context.getString(BasicConfigurationConstants.CONFIG_TYPE));
        List<Channel> channels = new ArrayList<Channel>();
        Configurables.configure(source, context);
        String[] channelNames = context.getString(
            BasicConfigurationConstants.CONFIG_CHANNELS).split("\\s+");
        for (String chName : channelNames) {
          channels.add(conf.getChannels().get(chName));
        }

        Map<String, String> selectorConfig = context.getSubProperties(
            BasicConfigurationConstants.CONFIG_SOURCE_CHANNELSELECTOR_PREFIX);

        ChannelSelector selector = ChannelSelectorFactory.create(
            channels, selectorConfig);

        ChannelProcessor channelProcessor = new ChannelProcessor(selector);
        Configurables.configure(channelProcessor, context);
View Full Code Here

        Configurables.configure(eventSource, context);

        List<Channel> channels = new ArrayList<Channel>();
        channels.add(channel);

        ChannelSelector cs = new ReplicatingChannelSelector();
        cs.setChannels(channels);

        eventSource.setChannelProcessor(new ChannelProcessor(cs));

        eventSource.start();
View Full Code Here

                    channels.add(conf.getChannels().get(chName));
                }

                ChannelSelectorConfiguration selectorConfig = config.getSelectorConfiguration();

                ChannelSelector selector = ChannelSelectorFactory.create(channels, selectorConfig);

                ChannelProcessor channelProcessor = new ChannelProcessor(selector);
                Configurables.configure(channelProcessor, config);

                source.setChannelProcessor(channelProcessor);
                conf.getSourceRunners().put(comp.getComponentName(), SourceRunner.forSource(source));
            }
        }
        Map<String, Context> sourceContexts = agentConf.getSourceContext();

        for (String src : sources) {
            Context context = sourceContexts.get(src);
            if (context != null){
                Source source = sourceFactory.create(src, context.getString(BasicConfigurationConstants.CONFIG_TYPE));
                List<Channel> channels = new ArrayList<Channel>();
                Configurables.configure(source, context);
                String[] channelNames = context.getString(BasicConfigurationConstants.CONFIG_CHANNELS).split("\\s+");
                for (String chName : channelNames) {
                    channels.add(conf.getChannels().get(chName));
                }

                Map<String, String> selectorConfig = context.getSubProperties(
                    BasicConfigurationConstants.CONFIG_SOURCE_CHANNELSELECTOR_PREFIX);

                ChannelSelector selector = ChannelSelectorFactory.create(channels, selectorConfig);

                ChannelProcessor channelProcessor = new ChannelProcessor(selector);
                Configurables.configure(channelProcessor, context);

                source.setChannelProcessor(channelProcessor);
View Full Code Here

TOP

Related Classes of org.apache.flume.ChannelSelector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.