Package org.apache.flume

Examples of org.apache.flume.SinkProcessor


    NullSink nullSink = new NullSink();
    nullSink.configure(new Context());
    nullSink.setChannel(channel);

    nodeManager.add(SourceRunner.forSource(generatorSource));
    SinkProcessor processor = new DefaultSinkProcessor();
    List<Sink> sinks = new ArrayList<Sink>();
    sinks.add(nullSink);
    processor.setSinks(sinks);
    nodeManager.add(new SinkRunner(processor));

    nodeManager.start();
    boolean reached = LifecycleController.waitForOneOf(nodeManager,
        LifecycleState.START_OR_ERROR);
View Full Code Here


    NullSink sink = new NullSink();
    sink.configure(new Context());
    sink.setChannel(channel);

    nodeManager.add(SourceRunner.forSource(source));
    SinkProcessor processor = new DefaultSinkProcessor();
    List<Sink> sinks = new ArrayList<Sink>();
    sinks.add(sink);
    processor.setSinks(sinks);
    nodeManager.add(new SinkRunner(processor));

    for (int i = 0; i < 10; i++) {
      nodeManager.start();
      boolean reached = LifecycleController.waitForOneOf(nodeManager,
View Full Code Here

List<Sink> sinks) {
    Preconditions.checkNotNull(context);
    Preconditions.checkNotNull(sinks);
    Preconditions.checkArgument(!sinks.isEmpty());
    Map<String, String> params = context.getParameters();
    SinkProcessor processor;
    String typeStr = params.get(TYPE);
    SinkProcessorType type = SinkProcessorType.OTHER;
    String processorClassName = typeStr;
    try {
      type = SinkProcessorType.valueOf(typeStr.toUpperCase());
    } catch (Exception ex) {
      logger.warn("Sink type {} is a custom type", typeStr);
    }

    if(!type.equals(SinkProcessorType.OTHER)) {
      processorClassName = type.getSinkProcessorClassName();
    }

    logger.debug("Creating instance of sink processor type {}, class {}",
            typeStr, processorClassName);
    Class<? extends SinkProcessor> processorClass = null;
    try {
      processorClass = (Class<? extends SinkProcessor>) Class.forName(
          processorClassName);
    } catch (Exception ex) {
      throw new FlumeException("Unable to load sink processor type: " + typeStr
          + ", class: " + type.getSinkProcessorClassName(), ex);
    }
    try {
      processor = processorClass.newInstance();
    } catch (Exception e) {
      throw new FlumeException("Unable to create sink processor, type: " + typeStr
          + ", class: " + processorClassName, e);
    }

    processor.setSinks(sinks);
    Configurables.configure(processor, context);
    return processor;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public static SinkProcessor getProcessor(ComponentConfiguration conf,
      List<Sink> sinks) {
    String typeStr = conf.getType();
    SinkProcessor processor;
    SinkProcessorType type = SinkProcessorType.DEFAULT;
    try {
      type = SinkProcessorType.valueOf(typeStr.toUpperCase());
    } catch (Exception ex) {
      logger.warn("Sink type {} does not exist, using default", typeStr);
    }

    Class<? extends SinkProcessor> processorClass = null;
    try {
      processorClass =
          (Class<? extends SinkProcessor>) Class.forName(type
              .getSinkProcessorClassName());
    } catch (Exception ex) {
      throw new FlumeException("Unable to load sink processor type: " + typeStr
          + ", class: " + type.getSinkProcessorClassName(), ex);
    }
    try {
      processor = processorClass.newInstance();
    } catch (Exception e) {
      throw new FlumeException("Unable to create processor, type: " + typeStr
          + ", class: " + type.getSinkProcessorClassName(), e);
    }

    processor.setSinks(sinks);
    Configurables.configure(processor, conf);
    return processor;
  }
View Full Code Here

    }
    // add any unassigned sinks to solo collectors
    for(Entry<String, Sink> entry : sinks.entrySet()) {
      if (!usedSinks.containsValue(entry.getKey())) {
        try {
          SinkProcessor pr = new DefaultSinkProcessor();
          List<Sink> sinkMap = new ArrayList<Sink>();
          sinkMap.add(entry.getValue());
          pr.setSinks(sinkMap);
          Configurables.configure(pr, new Context());
          sinkRunnerMap.put(entry.getKey(),
              new SinkRunner(pr));
        } catch(Exception e) {
          String msg = String.format("SinkGroup %s has been removed due to " +
View Full Code Here

List<Sink> sinks) {
    Preconditions.checkNotNull(context);
    Preconditions.checkNotNull(sinks);
    Preconditions.checkArgument(!sinks.isEmpty());
    Map<String, String> params = context.getParameters();
    SinkProcessor processor;
    String typeStr = params.get(TYPE);
    SinkProcessorType type = SinkProcessorType.OTHER;
    String processorClassName = typeStr;
    try {
      type = SinkProcessorType.valueOf(typeStr.toUpperCase(Locale.ENGLISH));
    } catch (Exception ex) {
      logger.warn("Sink Processor type {} is a custom type", typeStr);
    }

    if(!type.equals(SinkProcessorType.OTHER)) {
      processorClassName = type.getSinkProcessorClassName();
    }

    logger.debug("Creating instance of sink processor type {}, class {}",
            typeStr, processorClassName);
    Class<? extends SinkProcessor> processorClass = null;
    try {
      processorClass = (Class<? extends SinkProcessor>) Class.forName(
          processorClassName);
    } catch (Exception ex) {
      throw new FlumeException("Unable to load sink processor type: " + typeStr
          + ", class: " + type.getSinkProcessorClassName(), ex);
    }
    try {
      processor = processorClass.newInstance();
    } catch (Exception e) {
      throw new FlumeException("Unable to create sink processor, type: " + typeStr
          + ", class: " + processorClassName, e);
    }

    processor.setSinks(sinks);
    Configurables.configure(processor, context);
    return processor;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public static SinkProcessor getProcessor(ComponentConfiguration conf,
      List<Sink> sinks) {
    String typeStr = conf.getType();
    SinkProcessor processor;
    SinkProcessorType type = SinkProcessorType.DEFAULT;
    try {
      type = SinkProcessorType.valueOf(typeStr.toUpperCase(Locale.ENGLISH));
    } catch (Exception ex) {
      logger.warn("Sink type {} does not exist, using default", typeStr);
    }

    Class<? extends SinkProcessor> processorClass = null;
    try {
      processorClass =
          (Class<? extends SinkProcessor>) Class.forName(type
              .getSinkProcessorClassName());
    } catch (Exception ex) {
      throw new FlumeException("Unable to load sink processor type: " + typeStr
          + ", class: " + type.getSinkProcessorClassName(), ex);
    }
    try {
      processor = processorClass.newInstance();
    } catch (Exception e) {
      throw new FlumeException("Unable to create processor, type: " + typeStr
          + ", class: " + type.getSinkProcessorClassName(), e);
    }

    processor.setSinks(sinks);
    Configurables.configure(processor, conf);
    return processor;
  }
View Full Code Here

List<Sink> sinks) {
    Preconditions.checkNotNull(context);
    Preconditions.checkNotNull(sinks);
    Preconditions.checkArgument(!sinks.isEmpty());
    Map<String, String> params = context.getParameters();
    SinkProcessor processor;
    String typeStr = params.get(TYPE);
    SinkProcessorType type = SinkProcessorType.OTHER;
    String processorClassName = typeStr;
    try {
      type = SinkProcessorType.valueOf(typeStr.toUpperCase());
    } catch (Exception ex) {
      logger.warn("Sink Processor type {} is a custom type", typeStr);
    }

    if(!type.equals(SinkProcessorType.OTHER)) {
      processorClassName = type.getSinkProcessorClassName();
    }

    logger.debug("Creating instance of sink processor type {}, class {}",
            typeStr, processorClassName);
    Class<? extends SinkProcessor> processorClass = null;
    try {
      processorClass = (Class<? extends SinkProcessor>) Class.forName(
          processorClassName);
    } catch (Exception ex) {
      throw new FlumeException("Unable to load sink processor type: " + typeStr
          + ", class: " + type.getSinkProcessorClassName(), ex);
    }
    try {
      processor = processorClass.newInstance();
    } catch (Exception e) {
      throw new FlumeException("Unable to create sink processor, type: " + typeStr
          + ", class: " + processorClassName, e);
    }

    processor.setSinks(sinks);
    Configurables.configure(processor, context);
    return processor;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public static SinkProcessor getProcessor(ComponentConfiguration conf,
      List<Sink> sinks) {
    String typeStr = conf.getType();
    SinkProcessor processor;
    SinkProcessorType type = SinkProcessorType.DEFAULT;
    try {
      type = SinkProcessorType.valueOf(typeStr.toUpperCase());
    } catch (Exception ex) {
      logger.warn("Sink type {} does not exist, using default", typeStr);
    }

    Class<? extends SinkProcessor> processorClass = null;
    try {
      processorClass =
          (Class<? extends SinkProcessor>) Class.forName(type
              .getSinkProcessorClassName());
    } catch (Exception ex) {
      throw new FlumeException("Unable to load sink processor type: " + typeStr
          + ", class: " + type.getSinkProcessorClassName(), ex);
    }
    try {
      processor = processorClass.newInstance();
    } catch (Exception e) {
      throw new FlumeException("Unable to create processor, type: " + typeStr
          + ", class: " + type.getSinkProcessorClassName(), e);
    }

    processor.setSinks(sinks);
    Configurables.configure(processor, conf);
    return processor;
  }
View Full Code Here

    }
    // add any unassigned sinks to solo collectors
    for(Entry<String, Sink> entry : sinks.entrySet()) {
      if (!usedSinks.containsValue(entry.getKey())) {
        try {
          SinkProcessor pr = new DefaultSinkProcessor();
          List<Sink> sinkMap = new ArrayList<Sink>();
          sinkMap.add(entry.getValue());
          pr.setSinks(sinkMap);
          Configurables.configure(pr, new Context());
          sinkRunnerMap.put(entry.getKey(),
              new SinkRunner(pr));
        } catch(Exception e) {
          String msg = String.format("SinkGroup %s has been removed due to " +
View Full Code Here

TOP

Related Classes of org.apache.flume.SinkProcessor

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.