当前位置: 首页>>代码示例>>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;未经允许,请勿转载。