Released Mocked Streams for Apache Kafka
Kafka Streams is a deployment-agnostic stream processing library written in Java. Even though Kafka has a great test coverage, there is no easy way to write unit-tests for processing topologies, until now. I released Mocked Streams for Scala, which simply allows you to unit-test multi-input and output stateful stream topologies (since Apache Kafka >= 0.10.1) without Zookeeper and Kafka Brokers in your favorite Scala testing framework e.g. ScalaTest and Specs2.
import com.madewithtea.mockedstreams.MockedStreams val input = Seq(("x", "v1"), ("y", "v2"))
val expe = Seq(("x", "V1"), ("y", "V2"))
val strings = Serdes.String() MockedStreams()
.topology { builder => builder.stream(...) [...] }
.input("topic-in", strings, strings, input)
.output("topic-out", strings, strings, expe.size) shouldEqual expe
Mocked Streams
Mocked Streams 1.0 is a library which allows you to do the latter without much boilerplate code and in your favourite Scala testing framework. It wraps the org.apache.kafka.test.ProcessorTopologyTestDriver class, but adds more syntactic sugar to keep your test code simple. The features of the 1.0 release include:
- Multiple input and output streams
- Specify your topologies as a function: (KStreamBuilder => Unit)
- Use .config to pass your Kafka Streams configuration (e.g. Timestamp extractor)
- Use .outputTable to match against the compacted table output as Map[K,V]
- Support for Scala 2.11.8
- Support for Apache Kafka 0.10.1.0
Multiple Inputs and Outputs
val ms = MockedStreams()
.topology { builder => builder.stream(...) [...] }
.input("in-a", strings, ints, inputA)
.input("in-b", strings, ints, inputB)
.stores(Seq("store-name")) ms.output("out-a", strings, ints, expA.size) shouldEqual(expectedA)
ms.output("out-b", strings, ints, expB.size) shouldEqual(expectedB)
Getting Started
See the README for using Mocked Streams. For examples check out the test code of Mocked Streams itself. Mocked Streams is also located in the Maven Central Repository, hence you just need to add:
libraryDependencies += "com.madewithtea" %% "mockedstreams" % "1.0.0" % "test"
If you have any questions or issues regarding Mocked Streams, get in touch via Github. Alternatively, you can get in contact via mail.
Released Mocked Streams for Apache Kafka的更多相关文章
- Apache Samza - Reliable Stream Processing atop Apache Kafka and Hadoop YARN
http://engineering.linkedin.com/data-streams/apache-samza-linkedins-real-time-stream-processing-fram ...
- Apache Kafka for Item Setup
At Walmart.com in the U.S. and at Walmart's 11 other websites around the world, we provide seamless ...
- Apache Kafka:下一代分布式消息系统
[http://www.infoq.com/cn/articles/apache-kafka/]分布式发布-订阅消息系统. Kafka是一种快速.可扩展的.设计内在就是分布式的,分区的和可复制的提交日 ...
- Apache Kafka: Next Generation Distributed Messaging System---reference
Introduction Apache Kafka is a distributed publish-subscribe messaging system. It was originally dev ...
- DataPipeline |《Apache Kafka实战》作者胡夕:Apache Kafka监控与调优
胡夕 <Apache Kafka实战>作者,北航计算机硕士毕业,现任某互金公司计算平台总监,曾就职于IBM.搜狗.微博等公司.国内活跃的Kafka代码贡献者. 前言 虽然目前Apache ...
- An Overview of End-to-End Exactly-Once Processing in Apache Flink (with Apache Kafka, too!)
01 Mar 2018 Piotr Nowojski (@PiotrNowojski) & Mike Winters (@wints) This post is an adaptation o ...
- How Cigna Tuned Its Spark Streaming App for Real-time Processing with Apache Kafka
Explore the configuration changes that Cigna’s Big Data Analytics team has made to optimize the perf ...
- 《Apache Kafka 实战》读书笔记-认识Apache Kafka
<Apache Kafka 实战>读书笔记-认识Apache Kafka 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.kafka概要设计 kafka在设计初衷就是 ...
- Streaming SQL for Apache Kafka
KSQL是基于Kafka的Streams API进行构建的流式SQL引擎,KSQL降低了进入流处理的门槛,提供了一个简单的.完全交互式的SQL接口,用于处理Kafka的数据. KSQL是一套基于Apa ...
随机推荐
- 前端js模版 预编译工具Tmod js使用入门
1. 安装node js , 2. 用 npm install -g tmodjs 命令安装tmod 3.了解参数配置 4.运行测试例子->命令窗切换到当前文档位置 --->执行tomd ...
- web开发,关于jsp的常见问题,重复提交,防止后退。
看了网上的,有几种方法:1 在你的表单页里HEAD区加入这段代码: <META HTTP-EQUIV="pragma" CONTENT="no-cache" ...
- 浅析 Cordova for iOS
转自@夏小BO的技术博客: Cordova,对这个名字大家可能比较陌生,大家肯定听过 PhoneGap 这个名字,Cordova 就是 PhoneGap 被 Adobe 收购后所改的名字.(Cordo ...
- .Net如何在后台设置日期格式,并显示在前台页面上
其实方法比较老咯,有比这个简单的朋友请留言哈,我的思路是先将数据库中的日期格式读出来,在后台转化成DatetTime类型,然后在使用DateTime的内部方法设置日期格式,代码如下: DateTime ...
- Does the OpenSceneGraph have a native file format?
From OpenSceneGraph-3.0 onwards we have new native file formats based on generic serializers that ar ...
- supersr--NSURLConnection iOS2.0苹果原生请求
get请求1: NSURL*url = [NSURLURLWithString:@"http://127.0.0.1/demo.json"]; NSURLRequ ...
- self dismissModalViewControllerAnimated:YES 无效(dismissviewcontrolleranimated无效)
作为一个viewController(VC),想要消失的时候可以从parent VC里面调用dismissModalViewControllerAnimated来消去改VC,也可以在该VC里面手动调用 ...
- October 6th 2016 Week 41st Thursday
The outer world you see is a reflection of your inner self. 你拥有什么样的内心,你就会看到什么样的世界. And we eventually ...
- 解决客户端访问https报错
现象: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at com.sun.net.ssl. ...
- 重写List集合的ToString方法
重写方法: public class MyList<T> : List<T> where T : IConvertible { public override string T ...