Package org.apache.flume

Examples of org.apache.flume.FlumeException


    try {
      processorClass =
          (Class<? extends SinkProcessor>) Class.forName(type
              .getSinkProcessorClassName());
    } catch (Exception ex) {
      throw new FlumeException("Unable to load sink processor type: " + typeStr
          + ", class: " + type.getSinkProcessorClassName(), ex);
    }
    try {
      processor = processorClass.newInstance();
    } catch (Exception e) {
      throw new FlumeException("Unable to create processor, type: " + typeStr
          + ", class: " + type.getSinkProcessorClassName(), e);
    }

    processor.setSinks(sinks);
    Configurables.configure(processor, conf);
View Full Code Here


    //If rpcClient is null, it means either this appender object was never
    //setup by setting hostname and port and then calling activateOptions
    //or this appender object was closed by calling close(), so we throw an
    //exception to show the appender is no longer accessible.
    if(rpcClient == null){
      throw new FlumeException("Cannot Append to Appender!" +
          "Appender either closed or not setup correctly!");
    }

    if(!rpcClient.isActive()){
      reconnect();
    }

    //Client created first time append is called.
    Map<String, String> hdrs = new HashMap<String, String>();
    hdrs.put(Log4jAvroHeaders.LOGGER_NAME.toString(), event.getLoggerName());
    hdrs.put(Log4jAvroHeaders.TIMESTAMP.toString(),
        String.valueOf(event.getTimeStamp()));

    //To get the level back simply use
    //LoggerEvent.toLevel(hdrs.get(Integer.parseInt(
    //Log4jAvroHeaders.LOG_LEVEL.toString()))
    hdrs.put(Log4jAvroHeaders.LOG_LEVEL.toString(),
        String.valueOf(event.getLevel().toInt()));
    hdrs.put(Log4jAvroHeaders.MESSAGE_ENCODING.toString(), "UTF8");

    Event flumeEvent = EventBuilder.withBody(event.getMessage().toString(),
        Charset.forName("UTF8"), hdrs);

    try {
      rpcClient.append(flumeEvent);
    } catch (EventDeliveryException e) {
      String msg = "Flume append() failed.";
      LogLog.error(msg);
      throw new FlumeException(msg + " Exception follows.", e);
    }
  }
View Full Code Here

    Class<? extends Source> sourceClass = null;
    try {
      sourceClass = (Class<? extends Source>) Class.forName(sourceClassName);
    } catch (Exception ex) {
      throw new FlumeException("Unable to load source type: " + type
          + ", class: " + sourceClassName, ex);
    }

    Map<String, Source> sourceMap = sources.get(sourceClass);
    if (sourceMap == null) {
      sourceMap = new HashMap<String, Source>();
      sources.put(sourceClass, sourceMap);
    }

    Source source = sourceMap.get(name);

    if (source == null) {
      try {
        source = sourceClass.newInstance();
        source.setName(name);
        sourceMap.put(name, source);
      } catch (Exception ex) {
        // Clean up the source map
        sources.remove(sourceClass);
        throw new FlumeException("Unable to create source: " + name
            +", type: " + type + ", class: " + sourceClassName, ex);
      }
    }

    return source;
View Full Code Here

      File f1 = File.createTempFile("flume", "test", directory);
      Files.write("testing flume file permissions\n", f1, Charsets.UTF_8);
      Files.readLines(f1, Charsets.UTF_8);
      f1.delete();
    } catch (IOException e) {
      throw new FlumeException("Unable to read and modify files" +
          " in the spooling directory: " + directory, e);
    }
    this.directory = directory;
    this.completedSuffix = completedSuffix;
    this.bufferMaxLines = bufferMaxLines;
View Full Code Here

      for (Result r = rs.next(); r != null; r = rs.next()) {
        out = r.getValue(columnFamily.getBytes(), plCol.getBytes());

        if(i >= results.length - 1){
          rs.close();
          throw new FlumeException("More results than expected in the table." +
              "Expected = " + numEvents +". Found = " + i);
        }
        results[i++] = out;
        System.out.println(out);
      }
View Full Code Here

        int lastCharToPrint = Math.min(OVERFLOW_LINE_PRINT_CHARS,
            outLine.length());
        logger.error("Invalid line starts with: " +
          outLine.substring(0, lastCharToPrint));
        disabled = true;
        throw new FlumeException("Encoutered line that was too long.");
      }
      out.add(outLine);
      if (out.size() == n) { break; }
      outLine = currentFile.get().getReader().readLine();
    }
View Full Code Here

         * than that the destination file exists (actually, that remains
         * possible w/ small probability due to TOC-TOU conditions).*/
        String message = "Unable to move " + currPath + " to " + newPath +
            ". This will likely cause duplicate events. Please verify that " +
            "flume has sufficient permissions to perform these operations.";
        throw new FlumeException(message);
      }
    }
  }
View Full Code Here

        }
        PutRequest putRequest =  new PutRequest(table, rowKey, cf,
            payloadColumn, payload);
        actions.add(putRequest);
      } catch (Exception e){
        throw new FlumeException("Could not get row key!", e);
      }
    }
    return actions;
  }
View Full Code Here

        put.add(cf, colNames.get(i), m.group(i + 1).getBytes(Charsets.UTF_8));
      }
      actions.add(put);
    }
    catch (Exception e) {
      throw new FlumeException("Could not get row key!", e);
    }
    return actions;
  }
View Full Code Here

    try {
      latch.await();
    } catch (InterruptedException e) {
      sinkCounter.incrementConnectionFailedCount();
      throw new FlumeException(
          "Interrupted while waiting for Hbase Callbacks", e);
    }
    if(fail.get()){
      sinkCounter.incrementConnectionFailedCount();
      throw new FlumeException(
          "Could not start sink. " +
          "Table or column family does not exist in Hbase.");
    } else {
      open = true;
    }
View Full Code Here

TOP

Related Classes of org.apache.flume.FlumeException

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.