net.manub.embeddedkafka.streams

EmbeddedKafkaStreamsAllInOne

trait EmbeddedKafkaStreamsAllInOne extends EmbeddedKafkaStreams with Consumers

Convenience trait for testing Kafka Streams with ScalaTest. It exposes EmbeddedKafkaStreams.runStreams as well as Consumers api for easily creating and querying consumers in tests.

e.g.

runStreams(Seq("inputTopic", "outputTopic", streamBuilder) {
withConsumer[String, String, Unit] { consumer =>
  // here you can publish and consume messages and make assertions
  publishToKafka(in, Seq("one-string", "another-string"))
  consumeLazily(out).take(2).toList should be (
    Seq("one-string" -> "true", "another-string" -> "true")
  )
}
}
Self Type
EmbeddedKafkaStreamsAllInOne with Suite
See also

EmbeddedKafkaStreams

Consumers

Linear Supertypes
Consumers, EmbeddedKafkaStreams, TestStreamsConfig, EmbeddedKafka, EmbeddedKafkaSupport, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. EmbeddedKafkaStreamsAllInOne
  2. Consumers
  3. EmbeddedKafkaStreams
  4. TestStreamsConfig
  5. EmbeddedKafka
  6. EmbeddedKafkaSupport
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def consumeFirstMessageFrom[T](topic: String)(implicit config: EmbeddedKafkaConfig, deserializer: Deserializer[T]): T

    Definition Classes
    EmbeddedKafkaSupport
    Annotations
    @throws( ... ) @throws( ... )
  9. def consumeFirstStringMessageFrom(topic: String)(implicit config: EmbeddedKafkaConfig): String

    Definition Classes
    EmbeddedKafkaSupport
  10. def createCustomTopic(topic: String, topicConfig: Map[String, String], partitions: Int, replicationFactor: Int)(implicit config: EmbeddedKafkaConfig): Unit

    Definition Classes
    EmbeddedKafkaSupport
  11. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  13. implicit val executionContext: ExecutionContextExecutorService

    Definition Classes
    EmbeddedKafkaSupport
  14. val executorService: ExecutorService

    Definition Classes
    EmbeddedKafkaSupport
  15. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  16. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  17. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  18. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  20. def newConsumer[K, V]()(implicit arg0: Deserializer[K], arg1: Deserializer[V], config: EmbeddedKafkaConfig): KafkaConsumer[K, V]

    Definition Classes
    Consumers
  21. final def notify(): Unit

    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  23. def publishStringMessageToKafka(topic: String, message: String)(implicit config: EmbeddedKafkaConfig): Unit

    Definition Classes
    EmbeddedKafkaSupport
  24. def publishToKafka[K, T](topic: String, key: K, message: T)(implicit config: EmbeddedKafkaConfig, keySerializer: Serializer[K], serializer: Serializer[T]): Unit

    Definition Classes
    EmbeddedKafkaSupport
    Annotations
    @throws( ... )
  25. def publishToKafka[T](topic: String, message: T)(implicit config: EmbeddedKafkaConfig, serializer: Serializer[T]): Unit

    Definition Classes
    EmbeddedKafkaSupport
    Annotations
    @throws( ... )
  26. def runStreams(topicsToCreate: Seq[String], builder: TopologyBuilder)(block: ⇒ Any)(implicit config: EmbeddedKafkaConfig): Any

    Execute Kafka streams and pass a block of code that can operate while the streams are active.

    Execute Kafka streams and pass a block of code that can operate while the streams are active. The code block can be used for publishing and consuming messages in Kafka. The block gets a pre-initialized kafka consumer that can be used implicitly for util methods such as consumeLazily(String).

    e.g.

    runStreams(Seq("inputTopic", "outputTopic", streamBuilder) {
    // here you can publish and consume messages and make assertions
    publishToKafka(in, Seq("one-string", "another-string"))
    consumeFirstStringMessageFrom(in) should be ("one-string")
    }
    topicsToCreate

    the topics that should be created in Kafka before launching the streams.

    builder

    the streams builder that will be used to instantiate the streams with a default configuration (all state directories are different and in temp folders)

    block

    the code block that will executed while the streams are active. Once the block has been executed the streams will be closed.

    Definition Classes
    EmbeddedKafkaStreams
  27. def runStreamsWithStringConsumer(topicsToCreate: Seq[String], builder: TopologyBuilder)(block: (KafkaConsumer[String, String]) ⇒ Any)(implicit config: EmbeddedKafkaConfig): Any

    Run Kafka Streams while offering a String-based consumer for easy testing of stream output.

    Run Kafka Streams while offering a String-based consumer for easy testing of stream output.

    topicsToCreate

    the topics that should be created. Usually these should be the topics that the Streams-under-test use for inputs and outputs. They need to be created before running the streams and this is automatically taken care of.

    builder

    the streams builder that contains the stream topology that will be instantiated

    block

    the block of testing code that will be executed by passing the simple String-based consumer.

    returns

    the result of the testing code

  28. def startKafka(config: EmbeddedKafkaConfig, kafkaLogDir: Directory): KafkaServer

    Definition Classes
    EmbeddedKafkaSupport
  29. def startZooKeeper(zooKeeperPort: Int, zkLogsDir: Directory): ServerCnxnFactory

    Definition Classes
    EmbeddedKafkaSupport
  30. def streamConfig(streamName: String, extraConfig: Map[String, AnyRef] = Map.empty)(implicit kafkaConfig: EmbeddedKafkaConfig): StreamsConfig

    Create a test stream config for a given stream.

    Create a test stream config for a given stream.

    streamName

    the name of the stream. It will be used as the Application ID

    extraConfig

    any additional configuration. If the keys are already defined in the default they will be overwritten with this

    kafkaConfig

    the Kafka test configuration

    returns

    the Streams configuration

    Definition Classes
    TestStreamsConfig
  31. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  32. def toString(): String

    Definition Classes
    AnyRef → Any
  33. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. def withConsumer[K, V, T](block: (KafkaConsumer[K, V]) ⇒ T)(implicit arg0: Deserializer[K], arg1: Deserializer[V], config: EmbeddedKafkaConfig): T

    Definition Classes
    Consumers
  37. def withRunningKafka(body: ⇒ Any)(implicit config: EmbeddedKafkaConfig): Any

    Definition Classes
    EmbeddedKafkaSupport
  38. def withStringConsumer[T](block: (KafkaConsumer[String, String]) ⇒ T)(implicit config: EmbeddedKafkaConfig): T

    Definition Classes
    Consumers
  39. val zkConnectionTimeoutMs: Int

    Definition Classes
    EmbeddedKafkaSupport
  40. val zkSecurityEnabled: Boolean

    Definition Classes
    EmbeddedKafkaSupport
  41. val zkSessionTimeoutMs: Int

    Definition Classes
    EmbeddedKafkaSupport

Inherited from Consumers

Inherited from EmbeddedKafkaStreams

Inherited from TestStreamsConfig

Inherited from EmbeddedKafka

Inherited from EmbeddedKafkaSupport

Inherited from AnyRef

Inherited from Any

Ungrouped