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

The following examples show how to use org.apache.flume.source.avro.Status#OK . 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: FlumePersistentAppenderTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
@Override
public Status appendBatch(final List<AvroFlumeEvent> events) throws AvroRemoteException {
    Preconditions.checkState(eventQueue.addAll(events));
    for (final AvroFlumeEvent event : events) {
        // System.out.println("Received event " + event.getHeaders().get(new org.apache.avro.util.Utf8(FlumeEvent.GUID)));
    }
    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 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 4
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 5
Source File: TestAvroSink.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.debug("Received event batch:{}; delaying for {}ms", events, delay);
  sleep();
  return Status.OK;
}
 
Example 6
Source File: TestAvroSink.java    From mt-flume with Apache License 2.0 4 votes vote down vote up
@Override
public Status append(AvroFlumeEvent event) throws AvroRemoteException {
  logger.debug("Received event:{}", event);
  return Status.OK;
}
 
Example 7
Source File: FlumePersistentPerf.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Override
public Status appendBatch(final List<AvroFlumeEvent> events)
    throws AvroRemoteException {
    Preconditions.checkState(eventQueue.addAll(events));
    return Status.OK;
}
 
Example 8
Source File: FlumePersistentPerf.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Override
public Status append(final AvroFlumeEvent event) throws AvroRemoteException {
    eventQueue.add(event);
    return Status.OK;
}
 
Example 9
Source File: FlumeEmbeddedAgentTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Override
public Status append(final AvroFlumeEvent event) throws AvroRemoteException {
    eventQueue.add(event);
    return Status.OK;
}
 
Example 10
Source File: TestEmbeddedAgent.java    From mt-flume with Apache License 2.0 4 votes vote down vote up
@Override
public Status appendBatch(List<AvroFlumeEvent> events)
    throws AvroRemoteException {
  Preconditions.checkState(eventQueue.addAll(events));
  return Status.OK;
}
 
Example 11
Source File: TestEmbeddedAgent.java    From mt-flume with Apache License 2.0 4 votes vote down vote up
@Override
public Status append(AvroFlumeEvent event) throws AvroRemoteException {
  eventQueue.add(event);
  return Status.OK;
}
 
Example 12
Source File: TestAvroSink.java    From mt-flume with Apache License 2.0 4 votes vote down vote up
@Override
public Status append(AvroFlumeEvent event) throws AvroRemoteException {
  logger.debug("Received event:{}; delaying for {}ms", event, delay);
  sleep();
  return Status.OK;
}
 
Example 13
Source File: TestAvroSink.java    From mt-flume with Apache License 2.0 4 votes vote down vote up
@Override
public Status appendBatch(List<AvroFlumeEvent> events)
    throws AvroRemoteException {
  logger.debug("Received event batch:{}", events);
  return Status.OK;
}
 
Example 14
Source File: FakeFlume.java    From incubator-retired-htrace with Apache License 2.0 4 votes vote down vote up
@Override
public Status append(AvroFlumeEvent event) {
  receivedEvents.add(event);
  return Status.OK;
}
 
Example 15
Source File: FlumeEmbeddedAppenderTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Override
public Status append(final AvroFlumeEvent event) throws AvroRemoteException {
    eventQueue.add(event);
    return Status.OK;
}
 
Example 16
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("OK: Received event from append(): {}",
      new String(event.getBody().array(), Charset.forName("UTF8")));
  return Status.OK;
}
 
Example 17
Source File: FlumePersistentAppenderTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@Override
public Status append(final AvroFlumeEvent event) throws AvroRemoteException {
    eventQueue.add(event);
    //System.out.println("Received event " + event.getHeaders().get(new org.apache.avro.util.Utf8(FlumeEvent.GUID)));
    return Status.OK;
}
 
Example 18
Source File: RunLocalTest.java    From hadoop-arch-book with Apache License 2.0 4 votes vote down vote up
@Override
public Status appendBatch(List<AvroFlumeEvent> events) throws
        AvroRemoteException {
  LOG.info("OK: Received " + events.size() + " events from appendBatch()");
  return Status.OK;
}
 
Example 19
Source File: RunLocalTest.java    From hadoop-arch-book with Apache License 2.0 4 votes vote down vote up
@Override
public Status append(AvroFlumeEvent event) throws AvroRemoteException {
  LOG.info("OK: Received event from append(): " + new String(event.getBody().array(), Charset.forName("UTF8")));
  return Status.OK;
}
 
Example 20
Source File: FakeFlume.java    From incubator-retired-htrace with Apache License 2.0 4 votes vote down vote up
@Override
public Status appendBatch(List<AvroFlumeEvent> events) {
  receivedEvents.addAll(events);
  return Status.OK;
}