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的更多相关文章

  1. storm trident 示例

    Storm Trident的核心数据模型是一批一批被处理的“流”,“流”在集群的分区在集群的节点上,对“流”的操作也是并行的在每个分区上进行. Trident有五种对“流”的操作: 1.      不 ...

  2. Storm Trident API

    在Storm Trident中有五种操作类型 Apply Locally:本地操作,所有操作应用在本地节点数据上,不会产生网络传输 Repartitioning:数据流重定向,单纯的改变数据流向,不会 ...

  3. storm trident的filter和函数

    目的:通过kafka输出的信息进行过滤,添加指定的字段后,进行打印 SentenceSpout: package Trident; import java.util.HashMap; import j ...

  4. Storm专题二:Storm Trident API 使用具体解释

    一.概述      Storm Trident中的核心数据模型就是"Stream",也就是说,Storm Trident处理的是Stream.可是实际上Stream是被成批处理的. ...

  5. storm trident function函数

    package cn.crxy.trident; import java.util.List; import backtype.storm.Config; import backtype.storm. ...

  6. Strom-7 Storm Trident 详细介绍

    一.概要 1.1 Storm(简介)      Storm是一个实时的可靠地分布式流计算框架.      具体就不多说了,举个例子,它的一个典型的大数据实时计算应用场景:从Kafka消息队列读取消息( ...

  7. Storm入门(十三)Storm Trident 教程

    转自:http://blog.csdn.net/derekjiang/article/details/9126185 英文原址:https://github.com/nathanmarz/storm/ ...

  8. Storm Trident详解

    Trident是基于Storm进行实时留处理的高级抽象,提供了对实时流4的聚集,投影,过滤等操作,从而大大减少了开发Storm程序的工作量.Trident还提供了针对数据库或则其他持久化存储的有状态的 ...

  9. storm trident 的介绍与使用

    一.trident 的介绍 trident 的英文意思是三叉戟,在这里我的理解是因为之前我们通过之前的学习topology spout bolt 去处理数据是没有问题的,但trident 的对spou ...

随机推荐

  1. chm TO html 另类方法

    因为网上下了很多chmtohtml ,都是试用版的, 转成html网页格式,总是有限制,或是不完整,我现在找到了一种折中方法,供大家参考 一,我的资源里有工具word to chm  里面有转成网页的 ...

  2. .NET Transactional File Manager

    .NET Transactional File Manager http://transactionalfilemgr.codeplex.com/ 对文件系统操作,比如copy, move, dele ...

  3. source insight完全卸载

    由于不知名原因 source insight崩溃了,使用自带的卸载,完成之后重新安装软件注册还是出问题.在网上搜索资料发现就是删除注册表中的内容. 由于列出的删除项目不完全,导致还是出问题. 最后删除 ...

  4. vsftpd FTP服务器配置

    步骤如下: 0. 进入目录/etc/vsftpd,将vsftpd.conf备份为vsftpd.conf.bak(否则启动时会启动这个)1. 进入目录/etc/vsftpd,创建文件myserver.c ...

  5. MySQL -- 调优

    多数时候数据库会成为整个系统的瓶颈,比如大的数据量的插入与修改,频繁的亦或是高流量的访问,都会对数据库系统带来很大的压力.我在平时工作的时候,总是会遇到大数据量的插入.修改或是查询的操作,所以在工作的 ...

  6. Packagist / Composer 中国全量镜像

    用法: 有两种方式启用本镜像服务: 将配置信息添加到 Composer 的配置文件 config.json 中(系统全局配置).见“例1 (推荐方式)” 将配置信息添加到单个项目的 composer. ...

  7. Android选择/拍照 剪裁 base64/16进制/byte上传图片+PHP接收图片

    转载请注明出处:http://blog.csdn.net/iwanghang/article/details/65633129认为博文实用,请点赞,请评论,请关注.谢谢! ~ 老规矩,先上GIF动态图 ...

  8. CLS(公共语言规范)的CLSCompliant(跨语言调用)

    .net的一个很重要的特性就是跨语言的编程,用C#写的dll可以在VB.net里调用,例如:用C#写的一个类,编译到dll中,然后在VB.net中调用: using System;namespace  ...

  9. C#基础视频教程3.2 常见控件类型和使用方法

    这一部分我们介绍如何使用第三方的控件,我们前面一节介绍了使用微软提供的官方控件,比较中规中矩,而且也不用担心稳定性.但是很多时候我们还是会希望用第三方的控件让自己的软件更美观,更独特. 就单纯的按钮, ...

  10. Nginx TCP Proxy模块的编译安装

    这次用一个国内开发者在GitHub上的开源项目https://github.com/yaoweibin/nginx_tcp_proxy_module 我的系统已经安装了最新的Nginx,现在需要下载源 ...