Package com.cloudera.flume.core

Examples of com.cloudera.flume.core.EventImpl


      enc.create(schema, 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);
    }

    enc.append(ei);
    enc.flush();
  }
View Full Code Here


        .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

   * This returns the FlumeEvent corresponding to the AvroEvent passed in the
   * constructor of this object.
   */
  public Event toFlumeEvent() {
    Preconditions.checkNotNull(evt, "AvroFlumeEvent is not initialized");
    return new EventImpl(this.getBody(), this.getTimestamp(), this
        .getPriority(), this.getNanos(), this.getHost(), this.getAttrs());
  }
View Full Code Here

      int remaining = buf.remaining();
      if (remaining > 0) {
        byte[] body = new byte[remaining];
        buf.get(body, 0, remaining); // read all data

        Event e = new EventImpl(body);
        e.set(A_TAILSRCFILE, file.getName().getBytes());
        try {
          sync.put(e);
        } catch (InterruptedException e1) {
          LOG.error("interruptedException! " + e1.getMessage(), e1);
          throw e1;
View Full Code Here

          buf.get(body, 0, sz - 1); // read data
          buf.get(); // read '\n'
          buf.mark(); // new mark.
          start = buf.position();

          Event e = new EventImpl(body);
          e.set(A_TAILSRCFILE, file.getName().getBytes());
          sync.put(e);
          madeProgress = true;
        }
      }
View Full Code Here

        .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

      // different output than last time, fail here
      throw new IOException(
          "OutputFormat instance can only write to the same OutputStream");
    }

    EventImpl ei = null;
    if (e instanceof EventImpl) {
      ei = (EventImpl) e;
    } else {
      // copy constructor to force into an EventImpl for reflection
      ei = new EventImpl(e);
    }
    sink.append(ei);
    sink.flush();
  }
View Full Code Here

    Map<String, byte[]> fields = new HashMap<String, byte[]>();
    if (service != null)
      fields.put("service", service.getBytes());
    // Event e = new EventImpl(body.getBytes(), d.getTime(), Priority.INFO,
    Event e = new EventImpl(s.getBytes(), d.getTime(), Priority.INFO,
        Clock.nanos(), host, fields);
    return e;

  }
View Full Code Here

   * of.
   *
   * Use the host and the nanos as a tag at the collector side.
   */
  private Event openEvent() {
    Event e = new EventImpl(new byte[0]);
    e.set(ATTR_ACK_TYPE, CHECKSUM_START);
    checksum = e.getTimestamp();
    e.set(ATTR_ACK_HASH, ByteBuffer.allocate(8).putLong(checksum).array());
    e.set(ATTR_ACK_TAG, tag);

    return e;
  }
View Full Code Here

  /**
   * Close events has the cumulative checksum value
   */
  private Event closeEvent() {
    Event e = new EventImpl(new byte[0]);
    e.set(ATTR_ACK_TYPE, CHECKSUM_STOP);
    e.set(ATTR_ACK_HASH, ByteBuffer.allocate(8).putLong(checksum).array());
    e.set(ATTR_ACK_TAG, tag);
    return e;
  }
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.