Package com.cloudera.flume.conf.SinkFactory

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


      }
    };
  }

  public static SinkBuilder hdfsBuilder() {
    return new SinkBuilder() {
      @Override
      public EventSink create(Context context, Object... argv) {
        Preconditions.checkArgument(argv.length <= 4 && argv.length >= 2,
            "usage: collectorSink[(dfsdir,path[,rollmillis], format)]");
        String logdir = FlumeConfiguration.get().getCollectorDfsDir(); // default
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

   * machine, and the second is a port
   *
   * e2eWal[("machine" [, port ] )]
   */
  public static SinkBuilder e2eBuilder() {
    return new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... argv) {
        Preconditions.checkArgument(argv.length <= 2,
            "usage: agentE2ESink(collectorhost[, port]{, " + BATCH_COUNT
                + "=1}{, " + BATCH_MILLIS + "=0}{,compression=false})");
View Full Code Here

   *
   * TODO(jon) Need to reimplement/check this to make sure it still works in
   * light of the changes to disk log management mechanisms.
   */
  public static SinkBuilder dfoBuilder() {
    return new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... argv) {
        Preconditions.checkArgument(argv.length <= 2,
            "usage: agentDFOSink(collectorhost[, port]{, " + BATCH_COUNT
                + "=1}{, " + BATCH_MILLIS + "=0}{,compression=false})");
View Full Code Here

   * machine, and the second is a port
   *
   * be[("machine" [, port ] )]
   */
  public static SinkBuilder beBuilder() {
    return new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... argv) {
        Preconditions.checkArgument(argv.length <= 2,
            "usage: agentBESink(collectorhost[, port]{, " + BATCH_COUNT
                + "=1}{, " + BATCH_MILLIS + "=0}{,compression=false})");
View Full Code Here

  public long getFails() {
    return fails.get();
  }

  public static SinkBuilder builder() {
    return new SinkBuilder() {
      @Override
      public EventSink build(Context context, String... argv) {
        Preconditions.checkArgument(argv.length == 2);
        String primary = argv[0];
        String secondary = argv[1];
View Full Code Here

    conf.set(FlumeConfiguration.COLLECTOR_OUTPUT_FORMAT, format);
    conf.set(FlumeConfiguration.COLLECTOR_DFS_COMPRESS_CODEC, codecName);

    // build a sink that outputs to that format.
    File f = FileUtil.mktempdir();
    SinkBuilder builder = EscapedCustomDfsSink.builder();
    EventSink snk = builder.create(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);
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.