Search in sources :

Example 1 with FrameFullTupleForwarder

use of org.apache.asterix.external.dataflow.FrameFullTupleForwarder in project asterixdb by apache.

the class DataflowUtils method getTupleForwarder.

public static ITupleForwarder getTupleForwarder(Map<String, String> configuration, FeedLogManager feedLogManager) throws HyracksDataException {
    ITupleForwarder.TupleForwardPolicy policyType = null;
    String propValue = configuration.get(ITupleForwarder.FORWARD_POLICY);
    if (ExternalDataUtils.isFeed(configuration)) {
        // TODO pass this value in the configuration and avoid this check for feeds
        policyType = TupleForwardPolicy.FEED;
    } else if (propValue == null) {
        policyType = TupleForwardPolicy.FRAME_FULL;
    } else {
        policyType = TupleForwardPolicy.valueOf(propValue.trim().toUpperCase());
    }
    switch(policyType) {
        case FEED:
            return new FeedTupleForwarder(feedLogManager);
        case FRAME_FULL:
            return new FrameFullTupleForwarder();
        case COUNTER_TIMER_EXPIRED:
            return CounterTimerTupleForwarder.create(configuration);
        case RATE_CONTROLLED:
            return RateControlledTupleForwarder.create(configuration);
        default:
            throw new RuntimeDataException(ErrorCode.UTIL_DATAFLOW_UTILS_UNKNOWN_FORWARD_POLICY);
    }
}
Also used : ITupleForwarder(org.apache.asterix.external.api.ITupleForwarder) FrameFullTupleForwarder(org.apache.asterix.external.dataflow.FrameFullTupleForwarder) FeedTupleForwarder(org.apache.asterix.external.dataflow.FeedTupleForwarder) TupleForwardPolicy(org.apache.asterix.external.api.ITupleForwarder.TupleForwardPolicy) RuntimeDataException(org.apache.asterix.common.exceptions.RuntimeDataException)

Aggregations

RuntimeDataException (org.apache.asterix.common.exceptions.RuntimeDataException)1 ITupleForwarder (org.apache.asterix.external.api.ITupleForwarder)1 TupleForwardPolicy (org.apache.asterix.external.api.ITupleForwarder.TupleForwardPolicy)1 FeedTupleForwarder (org.apache.asterix.external.dataflow.FeedTupleForwarder)1 FrameFullTupleForwarder (org.apache.asterix.external.dataflow.FrameFullTupleForwarder)1