Skip to content

Adding return types to methods. Also, limiting scopes of some variables. #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object EmbeddedKafka extends EmbeddedKafkaSupport {
*
* @param config an implicit [[EmbeddedKafkaConfig]]
*/
def start()(implicit config: EmbeddedKafkaConfig) = {
def start()(implicit config: EmbeddedKafkaConfig): Unit = {
factory = Option(startZooKeeper(config.zooKeeperPort))
broker = Option(startKafka(config))
}
Expand Down Expand Up @@ -86,8 +86,8 @@ object EmbeddedKafka extends EmbeddedKafkaSupport {
}

sealed trait EmbeddedKafkaSupport {
val executorService = Executors.newFixedThreadPool(2)
implicit val executionContext =
private val executorService = Executors.newFixedThreadPool(2)
implicit private val executionContext =
ExecutionContext.fromExecutorService(executorService)

val zkSessionTimeoutMs = 10000
Expand All @@ -100,7 +100,7 @@ sealed trait EmbeddedKafkaSupport {
* @param body the function to execute
* @param config an implicit [[EmbeddedKafkaConfig]]
*/
def withRunningKafka(body: => Any)(implicit config: EmbeddedKafkaConfig) = {
def withRunningKafka(body: => Any)(implicit config: EmbeddedKafkaConfig): Any = {

val factory = startZooKeeper(config.zooKeeperPort)
val broker = startKafka(config)
Expand Down Expand Up @@ -238,7 +238,7 @@ sealed trait EmbeddedKafkaSupport {
}

def thatSerializesValuesWith[V](serializer: Class[_ <: Serializer[V]])(
implicit config: EmbeddedKafkaConfig) = {
implicit config: EmbeddedKafkaConfig): KafkaProducer[String, V] = {
val producer = new KafkaProducer[String, V](
baseProducerConfig + (ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG -> classOf[
StringSerializer].getName,
Expand All @@ -248,7 +248,7 @@ sealed trait EmbeddedKafkaSupport {
}

def apply[V](implicit valueSerializer: Serializer[V],
config: EmbeddedKafkaConfig) = {
config: EmbeddedKafkaConfig): KafkaProducer[String, V] = {
val producer = new KafkaProducer[String, V](baseProducerConfig(config),
new StringSerializer,
valueSerializer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package net.manub.embeddedkafka

case class EmbeddedKafkaConfig(kafkaPort: Int = 6001,
zooKeeperPort: Int = 6000,
customBrokerProperties: Map[String, String] =
Map.empty)
customBrokerProperties: Map[String, String] = Map.empty)

object EmbeddedKafkaConfig {
implicit val defaultConfig = EmbeddedKafkaConfig()
Expand Down