Package com.cloudera.flume.core

Examples of com.cloudera.flume.core.EventImpl


  @SuppressWarnings("serial")
  @Test
  public void testEventQueueMillis() throws InterruptedException {
    Thread.sleep(100);

    final Event e = new EventImpl("test".getBytes());
    EventQueue q = new EventQueue(10) {
      {
        add(e);
        System.out.println("insert " + e.getTimestamp() + " " + e.getNanos()
            + " " + e);
        add(e4);
        System.out.println("insert " + e4.getTimestamp() + " " + e4.getNanos()
            + " " + e4);
        add(e2);
View Full Code Here


  private Event testEvent;

  @Before
  public void setUp() {
    testEvent = new EventImpl();

    testEvent.set("one", "one".getBytes());
    testEvent.set("two", "two".getBytes());
  }
View Full Code Here

  @Test
  public void testReportSink() throws FlumeSpecException, IOException, InterruptedException {
    String spec = "{benchinject(\"foo\") => {benchreport(\"report\", \"[ console , counter(\\\"test\\\") ]\")  => null } }";
    EventSink snk = FlumeBuilder.buildSink(new ReportTestingContext(), spec);
    snk.open();
    snk.append(new EventImpl(new byte[0]));
    snk.append(new EventImpl(new byte[0]));
    snk.close();

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

    // this is a slight tweak to avoid port conflicts
    final ThriftEventSource tes = new ThriftEventSource(
        conf.getCollectorPort() + 1);
    tes.open();

    tes.enqueue(new EventImpl(new byte[0]));

    tes.close();

  }
View Full Code Here

      while (true) {
        String s2 = raf.readLine();
        if (s2 == null) {
          // reached the last line
          prevLine = null;
          Event e = new EventImpl(builder.toString().getBytes(), d.getTime(),
              Priority.valueOf(prio), nanos, host,
              new HashMap<String, byte[]>());
          return e;
        }

        // valid line, need to get more lines.
        Matcher m2 = l4jPat.matcher(s2);
        if (m2.matches()) {
          // a new matching line? event finished, save line for next round.
          Event e = new EventImpl(builder.toString().getBytes(), d.getTime(),
              Priority.valueOf(prio), nanos, host,
              new HashMap<String, byte[]>());
          prevLine = s2;
          return e;
        }
View Full Code Here

  public Event next() throws IOException {
    if (count >= msgs)
      return null;// end marker if gotten to count
    count++;

    Event e = new EventImpl(new byte[0]);
    for (String a : attrNames) {
      byte[] val = new byte[valSz];
      rand.nextBytes(val);
      e.set(a, val);

    }
    updateEventProcessingStats(e);

    return e;
View Full Code Here

    if (count >= total && total != 0)
      return null;// end marker if gotten to count
    count++;
    byte[] data = new byte[size];
    rand.nextBytes(data);
    Event e = new EventImpl(data);
    updateEventProcessingStats(e);
    return e;
  }
View Full Code Here

    // build a sink that outputs to that format.
    File f = FileUtil.mktempdir();
    SinkBuilder builder = EscapedCustomDfsSink.builder();
    EventSink snk = builder.build(new Context(), "file:///" + f.getPath()
        + "/sub-%{service}");
    Event e = new EventImpl("this is a test message".getBytes());
    Attributes.setString(e, "service", "foo");
    snk.open();
    snk.append(e);
    snk.close();
View Full Code Here

    // build a sink that outputs to that format.
    File f = FileUtil.mktempdir();
    SinkBuilder builder = EscapedCustomDfsSink.builder();
    EventSink snk = builder.build(new Context(), "file:///" + f.getPath()
        + "/sub-%{service}");
    Event e = new EventImpl("this is a test message".getBytes());
    Attributes.setString(e, "service", "foo");
    snk.open();
    snk.append(e);
    snk.close();
View Full Code Here

    // build a sink that outputs to that format.
    File f = FileUtil.mktempdir();
    SinkBuilder builder = EscapedCustomDfsSink.builder();
    EventSink snk = builder.build(new Context(), "file:///" + f.getPath()
        + "/sub-%{service}");
    Event e = new EventImpl("this is a test message".getBytes());
    Attributes.setString(e, "service", "foo");
    snk.open();
    snk.append(e);
    snk.close();
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.