Package com.cloudera.flume.core

Examples of com.cloudera.flume.core.EventImpl


  /**
   * This creates an empty event. Used as a container for unmarshalling data
   * using the Writable mechanism
   */
  public WriteableEvent() {
    this(new EventImpl("".getBytes()));
  }
View Full Code Here


    String host = in.readUTF();

    Map<String, byte[]> fields = unserializeMap(in);

    // this should be the only instance where constructor with fields is used.
    e = new EventImpl(body, time, prio, nanos, host, fields);
  }
View Full Code Here

      // different output than last time?
      json.init(o);
      cachedOut = o;
    }

    EventImpl ei = null;
    if (e instanceof EventImpl) {
      ei = (EventImpl) e;
    } else {
      // copy constructor to force into an EventImpl for reflection
      ei = new EventImpl(e);
    }

    writer.write(ei, json);
    json.flush();
    o.write('\n');
View Full Code Here

      if (browser != null && !browser.equals("-")) {
        fields.put("browser", browser.getBytes());
      }

      Event e = new EventImpl(body.getBytes(), d.getTime(), Priority.INFO,
          Clock.nanos(), host, fields);
      return e;
    } catch (ParseException e) {
      LOG.warn("Failed to parse apache access log line: '" + s + "'", e);
      return null;
View Full Code Here

    MemorySinkSource mem = new MemorySinkSource();
    FanOutSink<EventSink> fo = new FanOutSink<EventSink>(cnt, mem);
    BatchingDecorator<EventSink> b = new BatchingDecorator<EventSink>(fo, 10, 0);
    b.open();
    for (int i = 0; i < total; i++) {
      Event e = new EventImpl(("message " + i).getBytes());
      b.append(e);
    }
    b.close();
    Assert.assertEquals(11, cnt.getCount());
View Full Code Here

    FanOutSink<EventSink> fo = new FanOutSink<EventSink>(cnt, mem);
    BatchingDecorator<EventSink> b = new BatchingDecorator<EventSink>(fo, 1024,
        3000);
    b.open();
    for (int i = 0; i < total; i++) {
      Event e = new EventImpl(("message " + i).getBytes());
      b.append(e);
    }
    Thread.sleep(5000);
    Assert.assertEquals(1, cnt.getCount());
    b.close();
View Full Code Here

    FanOutSink<EventSink> fo = new FanOutSink<EventSink>(cnt, mem);
    BatchingDecorator<EventSink> b = new BatchingDecorator<EventSink>(fo, 10,
        3000);
    b.open();
    for (int i = 0; i < total; i++) {
      Event e = new EventImpl(("message " + i).getBytes());
      b.append(e);
    }
    b.close();
    Assert.assertEquals(11, cnt.getCount());
  }
View Full Code Here

    MemorySinkSource mem = new MemorySinkSource();
    BatchingDecorator<EventSink> b = new BatchingDecorator<EventSink>(mem, 10,
        0);
    b.open();
    for (int i = 0; i < 100; i++) {
      Event e = new EventImpl(("canned data " + i).getBytes());
      b.append(e);
    }

    MemorySinkSource mem2 = new MemorySinkSource();
    GzipDecorator<EventSink> gz = new GzipDecorator<EventSink>(mem2);
View Full Code Here

        new ConsoleEventSink(), 2, 100000);
    snk.open();

    for (int i = 0; i < 10; i++) {
      if (i % 4 == 0) {
        snk.append(new EventImpl(("test " + i).getBytes()));

      }
      snk.endBatchTimeout();
    }
    snk.close();
View Full Code Here

  public void testBloomReportSink() throws FlumeSpecException, IOException,
      InterruptedException {
    String spec = "{bloomGen(100,2) => {bloomCheck(100,2,\"counter(\\\"test\\\") \")  => counter(\"total\") } } }";
    EventSink snk = FlumeBuilder.buildSink(new ReportTestingContext(), spec);
    snk.open();
    snk.append(new EventImpl(new byte[0]));
    snk.append(new EventImpl(new byte[0]));

    CounterSink ctr = (CounterSink) ReportManager.get().getReportable("test");
    assertEquals(0, ctr.getCount());
    CounterSink total = (CounterSink) ReportManager.get()
        .getReportable("total");
View Full Code Here

TOP

Related Classes of com.cloudera.flume.core.EventImpl

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.