當前位置: 首頁>>代碼示例>>Java>>正文


Java ValueJoiner類代碼示例

本文整理匯總了Java中org.apache.kafka.streams.kstream.ValueJoiner的典型用法代碼示例。如果您正苦於以下問題:Java ValueJoiner類的具體用法?Java ValueJoiner怎麽用?Java ValueJoiner使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ValueJoiner類屬於org.apache.kafka.streams.kstream包,在下文中一共展示了ValueJoiner類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: leftJoin

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
@Override
public <V1, R> KStream<K, R> leftJoin(
    final KStream<K, V1> other,
    final ValueJoiner<? super V, ? super V1, ? extends R> joiner,
    final JoinWindows windows,
    final Serde<K> keySerde,
    final Serde<V> thisValSerde,
    final Serde<V1> otherValueSerde) {

    return doJoin(other,
        joiner,
        windows,
        keySerde,
        thisValSerde,
        otherValueSerde,
        new KStreamImplJoin(true, false));
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:18,代碼來源:KStreamImpl.java

示例2: join

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
private KTable<String, String> join(final KTable<String, String> first,
                                    final KTable<String, String> second,
                                    final JoinType joinType,
                                    final String queryableName) {
    final ValueJoiner<String, String, String> joiner = new ValueJoiner<String, String, String>() {
        @Override
        public String apply(final String value1, final String value2) {
            return value1 + "-" + value2;
        }
    };

    switch (joinType) {
        case INNER:
            return first.join(second, joiner, Serdes.String(), queryableName);
        case LEFT:
            return first.leftJoin(second, joiner, Serdes.String(), queryableName);
        case OUTER:
            return first.outerJoin(second, joiner, Serdes.String(), queryableName);
    }

    throw new RuntimeException("Unknown join type.");
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:23,代碼來源:KTableKTableJoinIntegrationTest.java

示例3: join

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
@Override
public <V1, R> KStream<K, R> join(
        final KStream<K, V1> other,
        final ValueJoiner<? super V, ? super V1, ? extends R> joiner,
        final JoinWindows windows,
        final Serde<K> keySerde,
        final Serde<V> thisValueSerde,
        final Serde<V1> otherValueSerde) {

    return doJoin(other, joiner, windows, keySerde, thisValueSerde, otherValueSerde, new KStreamImplJoin(false, false));
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:12,代碼來源:KStreamImpl.java

示例4: outerJoin

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
@Override
public <V1, R> KStream<K, R> outerJoin(
    final KStream<K, V1> other,
    final ValueJoiner<? super V, ? super V1, ? extends R> joiner,
    final JoinWindows windows,
    final Serde<K> keySerde,
    final Serde<V> thisValueSerde,
    final Serde<V1> otherValueSerde) {

    return doJoin(other, joiner, windows, keySerde, thisValueSerde, otherValueSerde, new KStreamImplJoin(true, true));
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:12,代碼來源:KStreamImpl.java

示例5: doJoin

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
private <V1, R> KStream<K, R> doJoin(final KStream<K, V1> other,
                                     final ValueJoiner<? super V, ? super V1, ? extends R> joiner,
                                     final JoinWindows windows,
                                     final Serde<K> keySerde,
                                     final Serde<V> thisValueSerde,
                                     final Serde<V1> otherValueSerde,
                                     final KStreamImplJoin join) {
    Objects.requireNonNull(other, "other KStream can't be null");
    Objects.requireNonNull(joiner, "joiner can't be null");
    Objects.requireNonNull(windows, "windows can't be null");

    KStreamImpl<K, V> joinThis = this;
    KStreamImpl<K, V1> joinOther = (KStreamImpl<K, V1>) other;

    if (joinThis.repartitionRequired) {
        joinThis = joinThis.repartitionForJoin(keySerde, thisValueSerde, null);
    }

    if (joinOther.repartitionRequired) {
        joinOther = joinOther.repartitionForJoin(keySerde, otherValueSerde, null);
    }

    joinThis.ensureJoinableWith(joinOther);

    return join.join(joinThis,
        joinOther,
        joiner,
        windows,
        keySerde,
        thisValueSerde,
        otherValueSerde);
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:33,代碼來源:KStreamImpl.java

示例6: globalTableJoin

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
private <K1, V1, V2> KStream<K, V2> globalTableJoin(final GlobalKTable<K1, V1> globalTable,
                                                    final KeyValueMapper<? super K, ? super V, ? extends K1> keyMapper,
                                                    final ValueJoiner<? super V, ? super V1, ? extends V2> joiner,
                                                    final boolean leftJoin) {
    Objects.requireNonNull(globalTable, "globalTable can't be null");
    Objects.requireNonNull(keyMapper, "keyMapper can't be null");
    Objects.requireNonNull(joiner, "joiner can't be null");

    final KTableValueGetterSupplier<K1, V1> valueGetterSupplier = ((GlobalKTableImpl<K1, V1>) globalTable).valueGetterSupplier();
    final String name = topology.newName(LEFTJOIN_NAME);
    topology.addProcessor(name, new KStreamGlobalKTableJoin<>(valueGetterSupplier, joiner, keyMapper, leftJoin), this.name);
    return new KStreamImpl<>(topology, name, sourceNodes, false);
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:14,代碼來源:KStreamImpl.java

示例7: doStreamTableJoin

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
private <V1, R> KStream<K, R> doStreamTableJoin(final KTable<K, V1> other,
                                                final ValueJoiner<? super V, ? super V1, ? extends R> joiner,
                                                final boolean leftJoin) {
    Objects.requireNonNull(other, "other KTable can't be null");
    Objects.requireNonNull(joiner, "joiner can't be null");

    final Set<String> allSourceNodes = ensureJoinableWith((AbstractStream<K>) other);

    final String name = topology.newName(leftJoin ? LEFTJOIN_NAME : JOIN_NAME);
    topology.addProcessor(name, new KStreamKTableJoin<>(((KTableImpl<K, ?, V1>) other).valueGetterSupplier(), joiner, leftJoin), this.name);
    topology.connectProcessorAndStateStores(name, ((KTableImpl<K, ?, V1>) other).internalStoreName());
    topology.connectProcessors(this.name, ((KTableImpl<K, ?, V1>) other).name);

    return new KStreamImpl<>(topology, name, allSourceNodes, false);
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:16,代碼來源:KStreamImpl.java

示例8: KStreamGlobalKTableJoin

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
KStreamGlobalKTableJoin(final KTableValueGetterSupplier<K2, V2> valueGetterSupplier,
                        final ValueJoiner<? super V1, ? super V2, ? extends R> joiner,
                        final KeyValueMapper<? super K1, ? super V1, ? extends K2> mapper,
                        final boolean leftJoin) {
    this.valueGetterSupplier = valueGetterSupplier;
    this.joiner = joiner;
    this.mapper = mapper;
    this.leftJoin = leftJoin;
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:10,代碼來源:KStreamGlobalKTableJoin.java

示例9: KStreamKStreamJoin

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
KStreamKStreamJoin(String otherWindowName, long joinBeforeMs, long joinAfterMs, ValueJoiner<? super V1, ? super V2, ? extends R> joiner, boolean outer) {
    this.otherWindowName = otherWindowName;
    this.joinBeforeMs = joinBeforeMs;
    this.joinAfterMs = joinAfterMs;
    this.joiner = joiner;
    this.outer = outer;
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:8,代碼來源:KStreamKStreamJoin.java

示例10: join

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
@Override
public <V1, R> KTable<K, R> join(final KTable<K, V1> other,
                                 final ValueJoiner<? super V, ? super V1, ? extends R> joiner,
                                 final Serde<R> joinSerde,
                                 final String queryableStoreName) {
    return doJoin(other, joiner, false, false, joinSerde, queryableStoreName);
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:8,代碼來源:KTableImpl.java

示例11: outerJoin

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
@Override
public <V1, R> KTable<K, R> outerJoin(final KTable<K, V1> other,
                                      final ValueJoiner<? super V, ? super V1, ? extends R> joiner,
                                      final Serde<R> joinSerde,
                                      final String queryableStoreName) {
    return doJoin(other, joiner, true, true, joinSerde, queryableStoreName);
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:8,代碼來源:KTableImpl.java

示例12: leftJoin

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
@Override
public <V1, R> KTable<K, R> leftJoin(final KTable<K, V1> other,
                                     final ValueJoiner<? super V, ? super V1, ? extends R> joiner,
                                     final Serde<R> joinSerde,
                                     final String queryableStoreName) {
    return doJoin(other, joiner, true, false, joinSerde, queryableStoreName);
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:8,代碼來源:KTableImpl.java

示例13: doJoin

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
@SuppressWarnings("unchecked")
private <V1, R> KTable<K, R> doJoin(final KTable<K, V1> other,
                                    ValueJoiner<? super V, ? super V1, ? extends R> joiner,
                                    final boolean leftOuter,
                                    final boolean rightOuter,
                                    final Serde<R> joinSerde,
                                    final String queryableStoreName) {
    Objects.requireNonNull(other, "other can't be null");
    Objects.requireNonNull(joiner, "joiner can't be null");

    final StateStoreSupplier storeSupplier = queryableStoreName == null ? null : keyValueStore(this.keySerde, joinSerde, queryableStoreName);

    return doJoin(other, joiner, leftOuter, rightOuter, storeSupplier);
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:15,代碼來源:KTableImpl.java

示例14: KTableKTableJoinValueGetter

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
public KTableKTableJoinValueGetter(final KTableValueGetter<K1, V1> valueGetter1,
                                   final KTableValueGetter<K2, V2> valueGetter2,
                                   final ValueJoiner<? super V1, ? super V2, ? extends R>  joiner,
                                   final KeyValueMapper<K1, V1, K2> keyValueMapper) {
    this.valueGetter1 = valueGetter1;
    this.valueGetter2 = valueGetter2;
    this.joiner = joiner;
    this.keyValueMapper = keyValueMapper;
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:10,代碼來源:KTableKTableJoinValueGetter.java

示例15: KTableKTableAbstractJoin

import org.apache.kafka.streams.kstream.ValueJoiner; //導入依賴的package包/類
KTableKTableAbstractJoin(KTableImpl<K, ?, V1> table1,
                         KTableImpl<K, ?, V2> table2,
                         ValueJoiner<? super V1, ? super V2, ? extends R> joiner) {
    this.table1 = table1;
    this.table2 = table2;
    this.valueGetterSupplier1 = table1.valueGetterSupplier();
    this.valueGetterSupplier2 = table2.valueGetterSupplier();
    this.joiner = joiner;
}
 
開發者ID:YMCoding,項目名稱:kafka-0.11.0.0-src-with-comment,代碼行數:10,代碼來源:KTableKTableAbstractJoin.java


注:本文中的org.apache.kafka.streams.kstream.ValueJoiner類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。