Skip to content

Commit

Permalink
Use Int instead of Integer to configure #partitions and replication f…
Browse files Browse the repository at this point in the history
…actor
  • Loading branch information
miguno committed Sep 29, 2014
1 parent cb2efad commit 3f476ae
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class KafkaEmbedded(config: Properties = new Properties) extends LazyLogging {
logger.debug(s"Shutdown of embedded Kafka broker at $brokerList completed (with ZK server at $zookeeperConnect)")
}

def createTopic(topic: String, partitions: Int = 1, replicationFactor: Int = 1, config: Properties = new Properties): Unit = {
def createTopic(topic: String, partitions: Int = 1, replicationFactor: Int = 1, config: Properties = new Properties): Unit = {
logger.debug(s"Creating topic { name: $topic, partitions: $partitions, replicationFactor: $replicationFactor, config: $config }")
val sessionTimeout = 10.seconds
val connectionTimeout = 8.seconds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class KafkaSparkStreamingSpec extends FeatureSpec with Matchers with BeforeAndAf
// And yes, the way we do this looks quite strange -- we combine a hardcoded `1` in the topic map with a
// subsequent `(1..N)` construct. But this approach is the recommended way.
val topics = Map(inputTopic.name -> 1)
val streams = (1 to inputTopic.partitions.toInt) map { _ =>
val streams = (1 to inputTopic.partitions) map { _ =>
KafkaUtils.createStream[Array[Byte], Array[Byte], DefaultDecoder, DefaultDecoder](
ssc,
kafkaParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class EmbeddedKafkaZooKeeperCluster(zookeeperPort: Integer = InstanceSpec.getRan

}

case class KafkaTopic(name: String, partitions: Integer = 1, replicationFactor: Integer = 1,
case class KafkaTopic(name: String, partitions: Int = 1, replicationFactor: Int = 1,
config: Properties = new Properties) {

require(partitions > 0)
Expand Down

0 comments on commit 3f476ae

Please sign in to comment.