Java Code Examples for org.apache.flume.source.avro.Status#FAILED

The following examples show how to use org.apache.flume.source.avro.Status#FAILED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AvroSource.java    From mt-flume with Apache License 2.0 6 votes vote down vote up
@Override
public Status append(AvroFlumeEvent avroEvent) {
  logger.debug("Avro source {}: Received avro event: {}", getName(),
      avroEvent);
  sourceCounter.incrementAppendReceivedCount();
  sourceCounter.incrementEventReceivedCount();

  Event event = EventBuilder.withBody(avroEvent.getBody().array(),
      toStringMap(avroEvent.getHeaders()));

  try {
    getChannelProcessor().processEvent(event);
  } catch (ChannelException ex) {
    logger.warn("Avro source " + getName() + ": Unable to process event. " +
        "Exception follows.", ex);
    return Status.FAILED;
  }

  sourceCounter.incrementAppendAcceptedCount();
  sourceCounter.incrementEventAcceptedCount();

  return Status.OK;
}
 
Example 2
Source File: RpcTestUtils.java    From mt-flume with Apache License 2.0 5 votes vote down vote up
@Override
public Status append(AvroFlumeEvent event) throws AvroRemoteException {
  if (failed) {
    logger.debug("Event rejected");
    return Status.FAILED;
  }
  logger.debug("LB: Received event from append(): {}",
      new String(event.getBody().array(), Charset.forName("UTF8")));
  appendCount++;
  return Status.OK;
}
 
Example 3
Source File: RpcTestUtils.java    From mt-flume with Apache License 2.0 5 votes vote down vote up
@Override
public Status appendBatch(List<AvroFlumeEvent> events) throws
    AvroRemoteException {
  if (failed) {
    logger.debug("Event batch rejected");
    return Status.FAILED;
  }
  logger.debug("LB: Received {} events from appendBatch()",
      events.size());

  appendBatchCount++;
  return Status.OK;
}
 
Example 4
Source File: RpcTestUtils.java    From mt-flume with Apache License 2.0 5 votes vote down vote up
@Override
public Status appendBatch(List<AvroFlumeEvent> events) throws
    AvroRemoteException {
  logger.info("Failed: Received {} events from appendBatch()",
      events.size());
  return Status.FAILED;
}
 
Example 5
Source File: AvroSource.java    From mt-flume with Apache License 2.0 5 votes vote down vote up
@Override
public Status appendBatch(List<AvroFlumeEvent> events) {
  logger.debug("Avro source {}: Received avro event batch of {} events.",
      getName(), events.size());
  sourceCounter.incrementAppendBatchReceivedCount();
  sourceCounter.addToEventReceivedCount(events.size());

  List<Event> batch = new ArrayList<Event>();

  for (AvroFlumeEvent avroEvent : events) {
    Event event = EventBuilder.withBody(avroEvent.getBody().array(),
        toStringMap(avroEvent.getHeaders()));

    batch.add(event);
  }

  try {
    getChannelProcessor().processEventBatch(batch);
  } catch (Throwable t) {
    logger.error("Avro source " + getName() + ": Unable to process event " +
        "batch. Exception follows.", t);
    if (t instanceof Error) {
      throw (Error) t;
    }
    return Status.FAILED;
  }

  sourceCounter.incrementAppendBatchAcceptedCount();
  sourceCounter.addToEventAcceptedCount(events.size());

  return Status.OK;
}
 
Example 6
Source File: TestLoadBalancingLog4jAppender.java    From mt-flume with Apache License 2.0 5 votes vote down vote up
@Override
public Status append(AvroFlumeEvent avroEvent) {
  if (isFail) {
    return Status.FAILED;
  }
  appendCount.incrementAndGet();
  return super.append(avroEvent);
}
 
Example 7
Source File: TestLoadBalancingLog4jAppender.java    From mt-flume with Apache License 2.0 5 votes vote down vote up
@Override
public Status appendBatch(List<AvroFlumeEvent> events) {
  if (isFail) {
    return Status.FAILED;
  }
  appendCount.addAndGet(events.size());
  return super.appendBatch(events);
}
 
Example 8
Source File: TestLoadBalancingLog4jAppender.java    From kite with Apache License 2.0 5 votes vote down vote up
@Override
public Status append(AvroFlumeEvent avroEvent) {
  if (isFail) {
    return Status.FAILED;
  }
  appendCount.incrementAndGet();
  return super.append(avroEvent);
}
 
Example 9
Source File: TestLoadBalancingLog4jAppender.java    From kite with Apache License 2.0 5 votes vote down vote up
@Override
public Status appendBatch(List<AvroFlumeEvent> events) {
  if (isFail) {
    return Status.FAILED;
  }
  appendCount.addAndGet(events.size());
  return super.appendBatch(events);
}
 
Example 10
Source File: RpcTestUtils.java    From mt-flume with Apache License 2.0 4 votes vote down vote up
@Override
public Status append(AvroFlumeEvent event) throws AvroRemoteException {
  logger.info("Failed: Received event from append(): {}",
      new String(event.getBody().array(), Charset.forName("UTF8")));
  return Status.FAILED;
}