Search in sources :

Example 31 with ConsumerCallbackResult

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

the class LoggingConsumer method onStartBootstrapSequence.

@Override
public ConsumerCallbackResult onStartBootstrapSequence(SCN startScn) {
    startDataEventSequenceStats();
    ConsumerCallbackResult result = super.onStartBootstrapSequence(startScn);
    return doStartDataEventSequence(startScn, result, true);
}
Also used : ConsumerCallbackResult(com.linkedin.databus.client.pub.ConsumerCallbackResult)

Example 32 with ConsumerCallbackResult

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

the class LoggingConsumer method onStartDataEventSequence.

@Override
public ConsumerCallbackResult onStartDataEventSequence(SCN startScn) {
    startDataEventSequenceStats();
    ConsumerCallbackResult result = super.onStartDataEventSequence(startScn);
    return doStartDataEventSequence(startScn, result, false);
}
Also used : ConsumerCallbackResult(com.linkedin.databus.client.pub.ConsumerCallbackResult)

Example 33 with ConsumerCallbackResult

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

the class BatchingDatabusCombinedConsumer method addBootstrapEvent.

private ConsumerCallbackResult addBootstrapEvent(T eventObj) {
    ConsumerCallbackResult result = ConsumerCallbackResult.SUCCESS;
    _bootstrapEvents.add(eventObj);
    if (_bootstrapEvents.size() >= _staticConfig.getBootstrapBatchSize()) {
        result = flushBootstrapEvents();
    }
    return result;
}
Also used : ConsumerCallbackResult(com.linkedin.databus.client.pub.ConsumerCallbackResult)

Example 34 with ConsumerCallbackResult

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

the class MultiConsumerCallback method onStartSource.

@Override
public ConsumerCallbackResult onStartSource(String source, Schema sourceSchema) {
    long curNanos = System.nanoTime();
    for (DatabusV2ConsumerRegistration consumerReg : _registrations) {
        for (DatabusCombinedConsumer consumer : consumerReg.getConsumers()) {
            ConsumerCallable<ConsumerCallbackResult> startSourceCallable = _callbackFactory.createStartSourceCallable(curNanos, source, sourceSchema, consumer, true);
            _currentBatch.add(startSourceCallable);
            if (_consumerStats != null)
                _consumerStats.registerEventsReceived(1);
        }
    }
    if (_loggingConsumer != null) {
        ConsumerCallable<ConsumerCallbackResult> startSourceCallable = _callbackFactory.createStartSourceCallable(curNanos, source, sourceSchema, _loggingConsumer, false);
        _currentBatch.add(startSourceCallable);
    }
    if (_log.isDebugEnabled()) {
        long endNanos = System.nanoTime();
        _log.debug("Time spent in databus clientlib by onStartSource = " + (endNanos - curNanos) / DbusConstants.NUM_NSECS_IN_MSEC + "ms");
    }
    return submitBatch(curNanos, false, true);
}
Also used : ConsumerCallbackResult(com.linkedin.databus.client.pub.ConsumerCallbackResult) DatabusCombinedConsumer(com.linkedin.databus.client.pub.DatabusCombinedConsumer)

Example 35 with ConsumerCallbackResult

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

the class MultiConsumerCallback method onError.

@Override
public ConsumerCallbackResult onError(Throwable err) {
    long curNanos = System.nanoTime();
    for (DatabusV2ConsumerRegistration consumerReg : _registrations) {
        for (DatabusCombinedConsumer consumer : consumerReg.getConsumers()) {
            ConsumerCallable<ConsumerCallbackResult> onErrorCallable = _callbackFactory.createOnErrorCallable(curNanos, err, consumer, true);
            _currentBatch.add(onErrorCallable);
            // FIXME:  bug?  "processed" usually means consumer callback has completed; registerErrorEventsProcessed() normally called only if consumer callback returns ERROR:  why no registerErrorEventsReceived() call here?
            if (_consumerStats != null)
                _consumerStats.registerErrorEventsProcessed(1);
        }
    }
    if (_loggingConsumer != null) {
        ConsumerCallable<ConsumerCallbackResult> onErrorCallable = _callbackFactory.createOnErrorCallable(curNanos, err, _loggingConsumer, false);
        _currentBatch.add(onErrorCallable);
    }
    if (_log.isDebugEnabled()) {
        long endNanos = System.nanoTime();
        _log.debug("Time spent in databus clientlib by onError = " + (endNanos - curNanos) / DbusConstants.NUM_NSECS_IN_MSEC + "ms");
    }
    return submitBatch(curNanos, true, true);
}
Also used : ConsumerCallbackResult(com.linkedin.databus.client.pub.ConsumerCallbackResult) DatabusCombinedConsumer(com.linkedin.databus.client.pub.DatabusCombinedConsumer)

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