Search in sources :

Example 1 with ConsumerCallbackResult

use of com.linkedin.databus.client.pub.ConsumerCallbackResult in project databus by linkedin.

the class JsonDtailPrinter method printGenericRecord.

/**
   * @see com.linkedin.databus2.tools.dtail.GenericRecordDtailPrinter#printGenericRecord(org.apache.avro.generic.GenericRecord)
   */
@Override
public ConsumerCallbackResult printGenericRecord(GenericRecord r) {
    ConsumerCallbackResult result = ConsumerCallbackResult.SUCCESS;
    try {
        _out.write(r.toString().getBytes(Charset.defaultCharset()));
        _out.write('\n');
    } catch (RuntimeException re) {
        LOG.error("event dump error: " + re.getMessage(), re);
        result = ConsumerCallbackResult.ERROR;
    } catch (IOException ioe) {
        LOG.error("event dump error: " + ioe.getMessage(), ioe);
        result = ConsumerCallbackResult.ERROR;
    }
    return result;
}
Also used : ConsumerCallbackResult(com.linkedin.databus.client.pub.ConsumerCallbackResult) IOException(java.io.IOException)

Example 2 with ConsumerCallbackResult

use of com.linkedin.databus.client.pub.ConsumerCallbackResult in project databus by linkedin.

the class BatchingDatabusCombinedConsumer method addDataEvent.

private ConsumerCallbackResult addDataEvent(T eventObj) {
    ConsumerCallbackResult result = ConsumerCallbackResult.SUCCESS;
    _streamEvents.add(eventObj);
    if (_streamEvents.size() >= _staticConfig.getStreamBatchSize()) {
        result = flushStreamEvents();
    }
    return result;
}
Also used : ConsumerCallbackResult(com.linkedin.databus.client.pub.ConsumerCallbackResult)

Example 3 with ConsumerCallbackResult

use of com.linkedin.databus.client.pub.ConsumerCallbackResult in project databus by linkedin.

the class BatchingDatabusCombinedConsumer method flushBootstrapEvents.

private ConsumerCallbackResult flushBootstrapEvents() {
    ConsumerCallbackResult result;
    if (0 == _bootstrapEvents.size())
        result = ConsumerCallbackResult.SUCCESS;
    else {
        result = onBootstrapEventsBatch(_bootstrapEvents);
        _bootstrapEvents.clear();
    }
    return result;
}
Also used : ConsumerCallbackResult(com.linkedin.databus.client.pub.ConsumerCallbackResult)

Example 4 with ConsumerCallbackResult

use of com.linkedin.databus.client.pub.ConsumerCallbackResult in project databus by linkedin.

the class BatchingDatabusCombinedConsumer method onDataEvent.

@Override
public ConsumerCallbackResult onDataEvent(DbusEvent e, DbusEventDecoder eventDecoder) {
    T eventObj = eventDecoder.getTypedValue(e, (T) null, _payloadClass);
    ConsumerCallbackResult result = addDataEvent(eventObj);
    return result;
}
Also used : ConsumerCallbackResult(com.linkedin.databus.client.pub.ConsumerCallbackResult)

Example 5 with ConsumerCallbackResult

use of com.linkedin.databus.client.pub.ConsumerCallbackResult in project databus by linkedin.

the class BatchingDatabusCombinedConsumer method flushStreamEvents.

private ConsumerCallbackResult flushStreamEvents() {
    ConsumerCallbackResult result;
    if (0 == _streamEvents.size())
        result = ConsumerCallbackResult.SUCCESS;
    else {
        result = onDataEventsBatch(_streamEvents);
        _streamEvents.clear();
    }
    return result;
}
Also used : ConsumerCallbackResult(com.linkedin.databus.client.pub.ConsumerCallbackResult)

Aggregations

ConsumerCallbackResult (com.linkedin.databus.client.pub.ConsumerCallbackResult)42 DatabusCombinedConsumer (com.linkedin.databus.client.pub.DatabusCombinedConsumer)9 IdNamePair (com.linkedin.databus.core.util.IdNamePair)3 IOException (java.io.IOException)3 DatabusStreamConsumer (com.linkedin.databus.client.pub.DatabusStreamConsumer)2 ConsumerCallbackStats (com.linkedin.databus.client.pub.mbean.ConsumerCallbackStats)2 UnifiedClientStats (com.linkedin.databus.client.pub.mbean.UnifiedClientStats)2 DbusEvent (com.linkedin.databus.core.DbusEvent)2 DbusEventBuffer (com.linkedin.databus.core.DbusEventBuffer)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Hashtable (java.util.Hashtable)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 GenericRecord (org.apache.avro.generic.GenericRecord)2 AfterTest (org.testng.annotations.AfterTest)2 BeforeTest (org.testng.annotations.BeforeTest)2 Test (org.testng.annotations.Test)2 Checkpoint (com.linkedin.databus.core.Checkpoint)1 DbusErrorEvent (com.linkedin.databus.core.DbusErrorEvent)1 DispatcherRetriesExhaustedException (com.linkedin.databus.core.DispatcherRetriesExhaustedException)1