-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add seekToBeginning option, reuse instances of kafka (de)serializers (#…
…179) * Add seekToBeginning option, reuse instances of kafka (de)serializers * disable 2.13 in ci * Change ObservableSeekOnStart to ADT, scalafmt
- Loading branch information
Showing
47 changed files
with
372 additions
and
104 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
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
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
60 changes: 60 additions & 0 deletions
60
kafka-0.10.x/src/main/scala/monix/kafka/config/ObservableSeekOnStart.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,60 @@ | ||
package monix.kafka.config | ||
|
||
import com.typesafe.config.ConfigException.BadValue | ||
|
||
/** Specifies whether to call `seekToEnd` or `seekToBeginning` when starting | ||
* [[monix.kafka.KafkaConsumerObservable KafkaConsumerObservable]] | ||
* | ||
* Available options: | ||
* | ||
* - [[ObservableSeekOnStart.End]] | ||
* - [[ObservableSeekOnStart.Beginning]] | ||
* - [[ObservableSeekOnStart.NoSeek]] | ||
*/ | ||
sealed trait ObservableSeekOnStart extends Serializable { | ||
def id: String | ||
|
||
def isSeekBeginning: Boolean = | ||
this match { | ||
case ObservableSeekOnStart.Beginning => true | ||
case _ => false | ||
} | ||
|
||
def isSeekEnd: Boolean = | ||
this match { | ||
case ObservableSeekOnStart.End => true | ||
case _ => false | ||
} | ||
} | ||
|
||
object ObservableSeekOnStart { | ||
|
||
@throws(classOf[BadValue]) | ||
def apply(id: String): ObservableSeekOnStart = | ||
id match { | ||
case End.id => End | ||
case Beginning.id => Beginning | ||
case NoSeek.id => NoSeek | ||
case _ => | ||
throw new BadValue("kafka.monix.observable.seek.onStart", s"Invalid value: $id") | ||
} | ||
|
||
/** Calls `consumer.seekToEnd()` when starting consumer. | ||
*/ | ||
case object End extends ObservableSeekOnStart { | ||
val id = "end" | ||
} | ||
|
||
/** Calls `consumer.seekToBeginning()` when starting consumer. | ||
*/ | ||
case object Beginning extends ObservableSeekOnStart { | ||
val id = "beginning" | ||
} | ||
|
||
/** Does not call neither `consumer.seekToEnd()` nor `consumer.seekToBeginning` | ||
* when starting consumer. | ||
*/ | ||
case object NoSeek extends ObservableSeekOnStart { | ||
val id = "no-seek" | ||
} | ||
} |
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
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
Oops, something went wrong.