This repository has been archived by the owner on May 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
111 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
language: scala | ||
sudo: false | ||
jdk: oraclejdk8 | ||
scala: | ||
- 2.11.11 | ||
- 2.12.4 | ||
sbt_args: -mem 1500 | ||
script: | ||
- sbt "++ ${TRAVIS_SCALA_VERSION}!" test | ||
cache: | ||
directories: | ||
- "$HOME/.ivy2/cache" | ||
- "$HOME/.sbt/launchers" | ||
before_cache: | ||
- find $HOME/.sbt -name "*.lock" | xargs rm | ||
- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=1.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 38 additions & 31 deletions
69
src/main/scala/com/lightbend/kafka/scala/streams/StreamsBuilderS.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,74 @@ | ||
/** | ||
* Copyright (C) 2018 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
* Copyright (C) 2018 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package com.lightbend.kafka.scala.streams | ||
|
||
import java.util.regex.Pattern | ||
|
||
import ImplicitConversions._ | ||
import org.apache.kafka.streams.kstream.{ GlobalKTable, Materialized } | ||
import com.lightbend.kafka.scala.streams.ImplicitConversions._ | ||
import org.apache.kafka.common.utils.Bytes | ||
import org.apache.kafka.streams.kstream.{GlobalKTable, Materialized} | ||
import org.apache.kafka.streams.processor.{ProcessorSupplier, StateStore} | ||
import org.apache.kafka.streams.state.{ StoreBuilder, KeyValueStore } | ||
import org.apache.kafka.streams.state.{KeyValueStore, StoreBuilder} | ||
import org.apache.kafka.streams.{Consumed, StreamsBuilder, Topology} | ||
import org.apache.kafka.common.utils.Bytes | ||
|
||
import scala.collection.JavaConverters._ | ||
|
||
/** | ||
* Wraps the Java class StreamsBuilder and delegates method calls to the underlying Java object. | ||
*/ | ||
class StreamsBuilderS { | ||
* Wraps the Java class StreamsBuilder and delegates method calls to the underlying Java object. | ||
*/ | ||
class StreamsBuilderS(inner: StreamsBuilder = new StreamsBuilder) { | ||
|
||
val inner = new StreamsBuilder | ||
def stream[K, V](topic: String): KStreamS[K, V] = | ||
inner.stream[K, V](topic) | ||
|
||
def stream[K, V](topic: String) : KStreamS[K, V] = | ||
inner.stream[K, V](topic) | ||
def stream[K, V](topic: String, consumed: Consumed[K, V]): KStreamS[K, V] = | ||
inner.stream[K, V](topic, consumed) | ||
|
||
def stream[K, V](topic: String, consumed: Consumed[K, V]) : KStreamS[K, V] = | ||
inner.stream[K, V](topic, consumed) | ||
|
||
def stream[K, V](topics: List[String]): KStreamS[K, V] = | ||
inner.stream[K, V](topics.asJava) | ||
def stream[K, V](topics: List[String]): KStreamS[K, V] = | ||
inner.stream[K, V](topics.asJava) | ||
|
||
def stream[K, V](topics: List[String], consumed: Consumed[K, V]): KStreamS[K, V] = | ||
inner.stream[K, V](topics.asJava, consumed) | ||
inner.stream[K, V](topics.asJava, consumed) | ||
|
||
def stream[K, V](topicPattern: Pattern) : KStreamS[K, V] = | ||
def stream[K, V](topicPattern: Pattern): KStreamS[K, V] = | ||
inner.stream[K, V](topicPattern) | ||
|
||
def stream[K, V](topicPattern: Pattern, consumed: Consumed[K, V]) : KStreamS[K, V] = | ||
def stream[K, V](topicPattern: Pattern, consumed: Consumed[K, V]): KStreamS[K, V] = | ||
inner.stream[K, V](topicPattern, consumed) | ||
|
||
def table[K, V](topic: String) : KTableS[K, V] = inner.table[K, V](topic) | ||
def table[K, V](topic: String): KTableS[K, V] = inner.table[K, V](topic) | ||
|
||
def table[K, V](topic: String, consumed: Consumed[K, V]) : KTableS[K, V] = | ||
def table[K, V](topic: String, consumed: Consumed[K, V]): KTableS[K, V] = | ||
inner.table[K, V](topic, consumed) | ||
|
||
def table[K, V](topic: String, consumed: Consumed[K, V], | ||
materialized: Materialized[K, V, KeyValueStore[Bytes, Array[Byte]]]): KTableS[K, V] = | ||
inner.table[K, V](topic, consumed, materialized) | ||
materialized: Materialized[K, V, KeyValueStore[Bytes, Array[Byte]]]): KTableS[K, V] = | ||
inner.table[K, V](topic, consumed, materialized) | ||
|
||
def table[K, V](topic: String, | ||
materialized: Materialized[K, V, KeyValueStore[Bytes, Array[Byte]]]): KTableS[K, V] = | ||
def table[K, V](topic: String, | ||
materialized: Materialized[K, V, KeyValueStore[Bytes, Array[Byte]]]): KTableS[K, V] = | ||
inner.table[K, V](topic, materialized) | ||
|
||
def globalTable[K, V](topic: String): GlobalKTable[K, V] = | ||
inner.globalTable(topic) | ||
|
||
def addStateStore(builder: StoreBuilder[_ <: StateStore]): StreamsBuilder = inner.addStateStore(builder) | ||
def globalTable[K, V](topic: String, consumed: Consumed[K, V]): GlobalKTable[K, V] = | ||
inner.globalTable(topic, consumed) | ||
|
||
def addGlobalStore(storeBuilder: StoreBuilder[_ <: StateStore], topic: String, sourceName: String, consumed: Consumed[_, _], processorName: String, stateUpdateSupplier: ProcessorSupplier[_, _]): StreamsBuilder = | ||
inner.addGlobalStore(storeBuilder,topic,sourceName,consumed,processorName,stateUpdateSupplier) | ||
def globalTable[K, V](topic: String, consumed: Consumed[K, V], | ||
materialized: Materialized[K, V, KeyValueStore[Bytes, Array[Byte]]]): GlobalKTable[K, V] = | ||
inner.globalTable(topic, consumed, materialized) | ||
|
||
def globalTable[K, V](topic: String, | ||
materialized: Materialized[K, V, KeyValueStore[Bytes, Array[Byte]]]): GlobalKTable[K, V] = | ||
inner.globalTable(topic, materialized) | ||
|
||
def build() : Topology = inner.build() | ||
} | ||
def addStateStore(builder: StoreBuilder[_ <: StateStore]): StreamsBuilder = inner.addStateStore(builder) | ||
|
||
def addGlobalStore(storeBuilder: StoreBuilder[_ <: StateStore], topic: String, sourceName: String, consumed: Consumed[_, _], processorName: String, stateUpdateSupplier: ProcessorSupplier[_, _]): StreamsBuilder = | ||
inner.addGlobalStore(storeBuilder, topic, sourceName, consumed, processorName, stateUpdateSupplier) | ||
|
||
def build(): Topology = inner.build() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.