Package com.cloudera.flume.core

Examples of com.cloudera.flume.core.EventImpl


    // 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

    // 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

        new ThriftRawEventSink("localhost", conf.getCollectorPort());
    try {
      sink.open();

      for (int i = 0; i < 100; i++) {
        Event e = new EventImpl(("This is a test " + i).getBytes());
        sink.append(e);
        Thread.sleep(200);
      }
    } catch (IOException e) {
      e.printStackTrace();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }

  }
View Full Code Here

    s = rd.readLine();
    if (s == null) {
      return null; // end of stream
    }
    Event e = new EventImpl(s.getBytes(CharEncUtils.RAW));
    updateEventProcessingStats(e);
    return e;
  }
View Full Code Here

public class TestWriteableEvent {

  @Test
  public void testWritableReversible() throws IOException {
    String s = "this is a test string";
    WriteableEvent e = new WriteableEvent(new EventImpl(s.getBytes()));
    ByteArrayOutputStream bas = new ByteArrayOutputStream();
    DataOutputStream out = new DataOutputStream(bas);
    e.write(out);
    out.flush();
    byte[] stuff = bas.toByteArray();
View Full Code Here

    Map<String, byte[]> fields = new HashMap<String, byte[]>();
    byte[] data = { 'd', 'a', 't', 'a' };
    fields.put("test", data);

    WriteableEvent e = new WriteableEvent(
        new EventImpl(s.getBytes(), Clock.unixTime(), Priority.INFO, Clock
            .nanos(), NetUtils.localhost(), fields));
    ByteArrayOutputStream bas = new ByteArrayOutputStream();
    DataOutputStream out = new DataOutputStream(bas);
    e.write(out);
    out.flush();
View Full Code Here

    fields.put("test", data);
    String val = "more data, with longer value";
    fields.put("moredata", val.getBytes());

    WriteableEvent e = new WriteableEvent(
        new EventImpl(s.getBytes(), Clock.unixTime(), Priority.INFO, Clock
            .nanos(), NetUtils.localhost(), fields));
    ByteArrayOutputStream bas = new ByteArrayOutputStream();
    DataOutputStream out = new DataOutputStream(bas);
    e.write(out);
    out.flush();
View Full Code Here

    File tmp = File.createTempFile("test", "tmp");
    tmp.deleteOnExit();
    SeqfileEventSink sink = new SeqfileEventSink(tmp);
    sink.open();
    for (int i = 0; i < 100; i++) {
      Event e = new EventImpl(("test " + i).getBytes());
      sink.append(e);
    }
    sink.close();

    SeqfileEventSource src = SeqfileEventSource
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.