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
Scalish #66
Open
ouertani
wants to merge
10
commits into
lightbend:develop
Choose a base branch
from
ouertani:scalish
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Scalish #66
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
684b7cf
Merge branch 'develop'
debasishg 8c983ab
Merge branch 'develop'
debasishg 64d0688
Merge branch 'develop'
debasishg c46ba0a
add KafkaStreamsS
ouertani b12d426
update travis scala version to 2.12.5
ouertani cc9e4e7
Merge branch 'develop' into scalish
ouertani 9f80c65
scalafmt format
ouertani b866bef
scalafmt format
ouertani a926865
scalafmt format
ouertani 8cf1c95
scalafmt format
ouertani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.1.0 | ||
sbt.version=1.1.2 |
89 changes: 89 additions & 0 deletions
89
src/main/scala/com/lightbend/kafka/scala/streams/KafkaStreamsS.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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package com.lightbend.kafka.scala.streams | ||
|
||
import java.util.Properties | ||
|
||
import org.apache.kafka.common.{Metric, MetricName} | ||
import org.apache.kafka.streams.processor.{StateRestoreListener, StreamPartitioner, ThreadMetadata} | ||
import org.apache.kafka.streams.state.{QueryableStoreType, StreamsMetadata} | ||
import org.apache.kafka.streams.{KafkaClientSupplier, KafkaStreams, StreamsConfig, Topology} | ||
|
||
import scala.collection.JavaConverters._ | ||
|
||
class KafkaStreamsS(inner: KafkaStreams) { | ||
|
||
def allMetadata(): Iterable[StreamsMetadata] = { | ||
inner.allMetadata().asScala | ||
} | ||
|
||
def allMetadataForStore(storeName: String): Iterable[StreamsMetadata] = { | ||
inner.allMetadataForStore(storeName).asScala | ||
} | ||
|
||
def cleanUp() = { | ||
inner.cleanUp() | ||
this | ||
} | ||
|
||
def close() = { | ||
inner.close() | ||
} | ||
|
||
def close(timeout: Long, timeUnit: java.util.concurrent.TimeUnit) = { | ||
inner.close(timeout, timeUnit) | ||
} | ||
|
||
def localThreadsMetadata(): Set[ThreadMetadata] = { | ||
inner.localThreadsMetadata.asScala.toSet | ||
} | ||
|
||
def metadataForKey[K](storeName: String, key: K, keySerializer: Serializer[K]): StreamsMetadata = { | ||
inner.metadataForKey(storeName, key, keySerializer) | ||
} | ||
|
||
def metadataForKey[K](storeName: String, key: K, partitioner: StreamPartitioner[_ >: K, _]): StreamsMetadata = { | ||
inner.metadataForKey(storeName, key, partitioner) | ||
} | ||
|
||
def metrics(): Map[MetricName, _ <: Metric] = { | ||
inner.metrics().asScala.toMap | ||
} | ||
|
||
def withGlobalStateRestoreListener(globalStateRestoreListener: StateRestoreListener) = { | ||
inner.setGlobalStateRestoreListener(globalStateRestoreListener) | ||
this | ||
} | ||
|
||
def withStateListener(listener: KafkaStreams.StateListener) = { | ||
inner.setStateListener(listener) | ||
this | ||
} | ||
|
||
def withUncaughtExceptionHandler(eh: java.lang.Thread.UncaughtExceptionHandler) = { | ||
inner.setUncaughtExceptionHandler(eh) | ||
this | ||
} | ||
|
||
def start(): KafkaStreamsS = { | ||
inner.start() | ||
this | ||
} | ||
|
||
def state(): KafkaStreams.State = { | ||
inner.state() | ||
} | ||
|
||
def store[T](storeName: String, queryableStoreType: QueryableStoreType[T]) = { | ||
inner.store(storeName, queryableStoreType) | ||
} | ||
} | ||
|
||
object KafkaStreamsS { | ||
def apply(s: StreamsBuilderS, p: Properties): KafkaStreamsS = new KafkaStreamsS(new KafkaStreams(s.build(), p)) | ||
|
||
def apply(topology: Topology, p: Properties): KafkaStreamsS = new KafkaStreamsS(new KafkaStreams(topology, p)) | ||
|
||
def apply(topology: Topology, config: StreamsConfig) = new KafkaStreamsS(new KafkaStreams(topology, config)) | ||
|
||
def apply(topology: Topology, config: StreamsConfig, clientSupplier: KafkaClientSupplier) = new KafkaStreamsS(new KafkaStreams(topology, config, clientSupplier)) | ||
|
||
} |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Way better 👍