Tormenta分布式系统的脚本包

联合创作 · 2023-10-01 06:48

Tormenta 是 Storm 分布式计算机系统的 Scala 扩展包。Tormenta 在 Storm 的 KafkaKestrel spouts消息 上添加了一个安全类型的包装器。此安全类型允许用户推送映射消息和筛选转换信息到 spout 消息层上去。

代码示例:

import com.twitter.tormenta.scheme._
import com.twitter.tormenta.spout._

// produces strings:
val scheme: Scheme[String] = Scheme { bytes => Some(new String(bytes)) }

// produces integers w/ string length:
val mappedScheme: Scheme[Int] = scheme.map(_.length)

// filters out all tuples less than 5:
val filteredScheme: Scheme[Int] = mappedScheme.filter(_ > 5)

// produces lengths for input strings > length of 5
val spout: KestrelSpout[Int] = new KestrelSpout(filteredScheme, hostSeq, "spout")
浏览 5
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报