Package com.cloudera.flume.conf.SinkFactory

Examples of com.cloudera.flume.conf.SinkFactory.SinkBuilder


  @Test
  public void testNoHang() throws IOException, InterruptedException,
      FlumeSpecException {
    // add a hanging sink.
    SinkFactoryImpl sf = new SinkFactoryImpl();
    sf.setSink("hang", new SinkBuilder() {

      @Override
      public EventSink build(Context context, String... argv) {
        return new EventSink.Base() {
          @Override
View Full Code Here


  /**
   * Adds a few simple sinks with known names
   */
  public static void setupSinkFactory() {
    SinkFactoryImpl sf = new SinkFactoryImpl();
    sf.setSink("one", new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... argv) {
        return new EventSink.Base() {
          public String getName() {
            return "One";
          }
        };
      }
    });
    sf.setSink("two", new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... argv) {
        return new EventSink.Base() {
          public String getName() {
            return "Two";
          }
        };
      }
    });
    sf.setSink("three", new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... argv) {
        return new EventSink.Base() {
          public String getName() {
            return "Three";
View Full Code Here

  @Before
  public void replaceEscapedCustomDfsSink() {
    // Replace the null with a memory buffer that we have a reference to
    SinkFactoryImpl sf = new SinkFactoryImpl();
    sf.setSink("null", new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... argv) {
        LOG.info("excapedCustomDfs replaced with MemorySinkSource");
        mem.reset();
        return mem;
View Full Code Here

public class TestPlugins extends EventSink.Base {
  public static List<Pair<String, SinkBuilder>> getSinkBuilders() {
    List<Pair<String, SinkBuilder>> builders =
        new ArrayList<Pair<String, SinkBuilder>>();
    builders.add(new Pair<String, SinkBuilder>("test-plugin",
        new SinkBuilder() {
          @Override
          public EventSink build(Context context, String... argv) {
            return new TestPlugins();
          }
        }));
View Full Code Here

   *
   * @throws InterruptedException
   */
  @Test
  public void testFailoverBuilder() throws IOException, InterruptedException {
    SinkBuilder bld = FailOverSink.builder();
    EventSink snk = bld.build(new ReportTestingContext(),
        "{intervalFlakeyAppend(2) => counter(\"pri\") } ", "counter(\"sec\")");
    snk.open();

    Event e = new EventImpl("foo".getBytes());
    snk.append(e);
View Full Code Here

   * @throws InterruptedException
   */
  @Test
  public void testBackoffFailoverBuilder() throws IOException,
      InterruptedException {
    SinkBuilder bld = BackOffFailOverSink.builder();
    EventSink snk = bld.build(new ReportTestingContext(),
        "{intervalFlakeyAppend(2) => counter(\"pri\") } ", "counter(\"sec\")");
    snk.open();

    Event e = new EventImpl("foo".getBytes());
    snk.append(e);
View Full Code Here

   * Test metrics
   */
  @Test
  public void testGetBackoffFailoverMetrics() throws JSONException {
    ReportTestUtils.setupSinkFactory();
    SinkBuilder bld = BackOffFailOverSink.builder();
    EventSink snk = bld.build(new ReportTestingContext(), "one", "two");
    ReportEvent rpt = snk.getMetrics();
    LOG.info(ReportUtil.toJSONObject(rpt).toString());
    assertNotNull(rpt.getLongMetric(BackOffFailOverSink.A_PRIMARY));
    assertNotNull(rpt.getLongMetric(BackOffFailOverSink.A_FAILS));
    assertNotNull(rpt.getLongMetric(BackOffFailOverSink.A_BACKUPS));
View Full Code Here

   * Test metrics
   */
  @Test
  public void testGetFailoverMetrics() throws JSONException {
    ReportTestUtils.setupSinkFactory();
    SinkBuilder bld = FailOverSink.builder();
    EventSink snk = bld.build(new ReportTestingContext(), "one", "two");
    ReportEvent rpt = snk.getMetrics();
    LOG.info(ReportUtil.toJSONObject(rpt).toString());
    assertNotNull(rpt.getLongMetric(FailOverSink.R_FAILS));
    assertNotNull(rpt.getLongMetric(FailOverSink.R_BACKUPS));
    assertNull(rpt.getStringMetric("primary.one.name"));
View Full Code Here

      Preconditions.checkArgument(ctx.getValue("foo").equals("bar"));
      LOG.info("Context Threaded");
    }

    public static SinkBuilder builder() {
      return new SinkBuilder() {
        @Override
        public EventSink build(Context context, String... argv) {
          return new CheckSink(context);
        }
      };
View Full Code Here

        this.argv = argv;
      }
    }

    SinkFactoryImpl sf = new SinkFactoryImpl();
    sf.setSink("context", new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... argv) {
        return new ContextSink(context, argv);
      }
    });
View Full Code Here

TOP

Related Classes of com.cloudera.flume.conf.SinkFactory.SinkBuilder

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.