Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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 @@ -54,7 +54,7 @@ class KafkaConsumerActorSpec(system_ : ActorSystem) extends KafkaIntSpec(system_
""".stripMargin)
)

def configuredActor(topic: String): Config =
def configuredActor: Config =
ConfigFactory.parseString(
s"""
| bootstrap.servers = "localhost:$kafkaPort",
Expand Down Expand Up @@ -98,7 +98,7 @@ class KafkaConsumerActorSpec(system_ : ActorSystem) extends KafkaIntSpec(system_
producer.flush()

// Consumer and actor config in same config file
val consumer = system.actorOf(KafkaConsumerActor.props(configuredActor(topic), new StringDeserializer(), new StringDeserializer(), testActor))
val consumer = system.actorOf(KafkaConsumerActor.props(configuredActor, new StringDeserializer(), new StringDeserializer(), testActor))
consumer ! Subscribe.AutoPartition(List(topic))

val rs = expectMsgClass(30.seconds, classOf[ConsumerRecords[String, String]])
Expand All @@ -120,7 +120,7 @@ class KafkaConsumerActorSpec(system_ : ActorSystem) extends KafkaIntSpec(system_
val downstreamActor = TestProbe().ref

// Consumer and actor config in same config file
val consumer = system.actorOf(KafkaConsumerActor.props(configuredActor(topic), new StringDeserializer(), new StringDeserializer(), downstreamActor))
val consumer = system.actorOf(KafkaConsumerActor.props(configuredActor, new StringDeserializer(), new StringDeserializer(), downstreamActor))
consumer ! Subscribe.AutoPartition(List(topic))

// Initiate DeathWatch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class ConfigureSerializationSpec extends KafkaIntSpec{
""".stripMargin
), keySerializer, valueSerializer)

val _ = KafkaProducer(conf)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Producer thread will stay in JVM even after finishing the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the picture I recorded from VisualVM.
screen shot 2018-04-19 at 17 16 43

val producer = KafkaProducer(conf)
producer.close

keySerializer.configuration shouldEqual "mock_value"
keySerializer.isKeySerializer shouldEqual true
Expand All @@ -66,7 +67,8 @@ class ConfigureSerializationSpec extends KafkaIntSpec{
""".stripMargin
), keyDeserializer, valueDeserializer)

val _ = KafkaConsumer(conf)
val consumer = KafkaConsumer(conf)
consumer.close

keyDeserializer.configuration shouldEqual "mock_value"
keyDeserializer.isKeyDeserializer shouldEqual true
Expand Down