storm trident merger
import java.util.List;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.generated.StormTopology;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Values;
import storm.trident.Stream;
import storm.trident.TridentTopology;
import storm.trident.operation.BaseFunction;
import storm.trident.operation.TridentCollector;
import storm.trident.testing.FixedBatchSpout;
import storm.trident.tuple.TridentTuple;
public class TridentLocalPologyMeger {
public static class SumBolt extends BaseFunction{
@Override
public void execute(TridentTuple tuple, TridentCollector collector) {
Integer value0 = tuple.getInteger(0);
System.err.println("value0="+value0 );
}
}
public static void main(String[] args) {
//输出为new Fields("sentence")
FixedBatchSpout spout = new FixedBatchSpout(new Fields("sentence"), 1, new Values(9999));
spout.setCycle(true);
TridentTopology tridentTopology = new TridentTopology();
Stream newStream = tridentTopology.newStream("spout1", spout);
tridentTopology.merge(newStream)
.each(new Fields("sentence"), new SumBolt(), new Fields(""));
LocalCluster localCluster = new LocalCluster();
localCluster.submitTopology("trident", new Config(), tridentTopology.build());
}
}
storm trident merger的更多相关文章
- storm trident 示例
Storm Trident的核心数据模型是一批一批被处理的“流”,“流”在集群的分区在集群的节点上,对“流”的操作也是并行的在每个分区上进行. Trident有五种对“流”的操作: 1. 不 ...
- Storm Trident API
在Storm Trident中有五种操作类型 Apply Locally:本地操作,所有操作应用在本地节点数据上,不会产生网络传输 Repartitioning:数据流重定向,单纯的改变数据流向,不会 ...
- storm trident的filter和函数
目的:通过kafka输出的信息进行过滤,添加指定的字段后,进行打印 SentenceSpout: package Trident; import java.util.HashMap; import j ...
- Storm专题二:Storm Trident API 使用具体解释
一.概述 Storm Trident中的核心数据模型就是"Stream",也就是说,Storm Trident处理的是Stream.可是实际上Stream是被成批处理的. ...
- storm trident function函数
package cn.crxy.trident; import java.util.List; import backtype.storm.Config; import backtype.storm. ...
- Strom-7 Storm Trident 详细介绍
一.概要 1.1 Storm(简介) Storm是一个实时的可靠地分布式流计算框架. 具体就不多说了,举个例子,它的一个典型的大数据实时计算应用场景:从Kafka消息队列读取消息( ...
- Storm入门(十三)Storm Trident 教程
转自:http://blog.csdn.net/derekjiang/article/details/9126185 英文原址:https://github.com/nathanmarz/storm/ ...
- Storm Trident详解
Trident是基于Storm进行实时留处理的高级抽象,提供了对实时流4的聚集,投影,过滤等操作,从而大大减少了开发Storm程序的工作量.Trident还提供了针对数据库或则其他持久化存储的有状态的 ...
- storm trident 的介绍与使用
一.trident 的介绍 trident 的英文意思是三叉戟,在这里我的理解是因为之前我们通过之前的学习topology spout bolt 去处理数据是没有问题的,但trident 的对spou ...
随机推荐
- python string和dict转换
字典(dict)转为字符串(string) 我们可以比较容易的将字典(dict)类型转为字符串(string)类型. 通过遍历dict中的所有元素就可以实现字典到字符串的转换: for key, va ...
- .net程序保护方式大观
.net软件保护方式大观 最近调试一个运行于.net 2.0下的软件,发现该软件使用的保护方式很具有代表性,基本囊括了现在.net下的所有保护措施.实践证明,这些保护措施就像全真七子,单打独斗功力差了 ...
- 如何将Emmet安装到Notepad++?
1.下载Notepad++插件;(zen-Coding for Notepad++)2.解压后将压缩包中的文件放入Notepad++安装目录下的plugins文件夹中;3.重新启动就能看到菜单栏上增加 ...
- appium+python自动化24-滑动方法封装(swipe)
swipe介绍 1.查看源码语法,起点和终点四个坐标参数,duration是滑动屏幕持续的时间,时间越短速度越快.默认为None可不填,一般设置500-1000毫秒比较合适. swipe(self, ...
- Guava的使用
package guava; import java.io.File; import java.io.IOException; import java.util.ArrayList; import j ...
- C++内存管理学习堆和栈
来源:http://c.chinaitlab.com/basic/936306_2.html 一 C++内存管理 1.内存分配方式 在讲解内存分配之前,首先,要了解程序在内存中都有什么区域,然后再详细 ...
- 高性能CSS
避免使用@import 有两种方式加载样式文件,一种是link元素,另一种是CSS 2.1加入@import.而在外部的CSS文件中使用@import会使得页面在加载时增加额外的延迟.虽然规则允许在样 ...
- vue项目中使用mockjs模拟接口返回数据
Mock.js 是一个模拟数据生成器,利用它,可以拦截ajax请求,直接模拟返回数据,这样前后端只要约定好数据格式,前端就不需要依赖后端的接口,可以直接使用模拟的数据了. 网上介绍mock的教程也较多 ...
- Node.js:get/post请求、全局对象、工具模块
一.GET/POST请求 在很多场景中,我们的服务器都需要跟用户的浏览器打交道,如表单提交.表单提交到服务器一般都使用 GET/POST 请求. 1.获取GET请求内容 由于GET请求直接被嵌入在路径 ...
- 六个前端开发工程师必备的Web设计模式/模块资源
Yahoo的设计模式库 Yahoo的设计模式库包含了很多可以帮助开发设计人员解决遇到的问题的资源,包括开发中常常需要处理的导航,互动效果及其布局网格等大家常用的组件和模块 响应式设计模式库 这个响应式 ...