• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TupleUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.storm.utils.TupleUtils的典型用法代码示例。如果您正苦于以下问题:Java TupleUtils类的具体用法?Java TupleUtils怎么用?Java TupleUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TupleUtils类属于org.apache.storm.utils包,在下文中一共展示了TupleUtils类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
@Override
public void execute(Tuple input) {
    if (TupleUtils.isTick(input)) {
        collector.ack(input);
        return;
    }

    try {
        Command cmd = (Command) input.getValueByField(EmitFields.COMMAND);
        BoltCommandHandler handler = handlerManager.getHandler(cmd);
        handler.handle(input);
        this.collector.ack(input);
    } catch (Exception e) {
        logger.error("Process data error", e);
        this.collector.reportError(e);
        this.collector.fail(input);
    }

}
 
开发者ID:BriData,项目名称:DBus,代码行数:20,代码来源:WrapperBolt.java


示例2: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
@Override
public void execute(Tuple input) {
    if (TupleUtils.isTick(input)) {
        collector.ack(input);
        return;
    }
    try {
        Command cmd = (Command) input.getValueByField(EmitFields.COMMAND);
        BoltCommandHandler handler = handlerManager.getHandler(cmd);
        handler.handle(input);
        this.collector.ack(input);
    } catch (Exception e) {
        this.collector.fail(input);
        this.collector.reportError(e);
        logger.error("Process Error!", e);
    }

}
 
开发者ID:BriData,项目名称:DBus,代码行数:19,代码来源:DbusAppenderBolt.java


示例3: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
@Override
public void execute(Tuple input) {
    if (TupleUtils.isTick(input)) {
        collector.ack(input);
        return;
    }

    try {
        Command cmd = (Command) input.getValueByField(EmitFields.COMMAND);
        BoltCommandHandler handler = handlerManager.getHandler(cmd);
        handler.handle(input);
    } catch (Exception e) {
        logger.error("Process data error", e);
        this.collector.reportError(e);
        this.collector.fail(input);
    }

}
 
开发者ID:BriData,项目名称:DBus,代码行数:19,代码来源:DbusKafkaWriterBolt.java


示例4: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
@Override
public void execute(Tuple tuple) {
    long currTime = System.currentTimeMillis();
    for (JoinInfo joinInfo : joinInfos) {
        joinInfo.expireAndAckTimedOutEntries(collector, currTime);
    }

    if (TupleUtils.isTick(tuple))
        return;

    try {
        String stream = streamKind.getStreamId(tuple);
        if (stream.equalsIgnoreCase(fromStream))
            processFromStreamTuple(tuple, currTime);
        else if(stream.equalsIgnoreCase(joinStream))
            processJoinStreamTuple(tuple, currTime);
        else
            throw new InvalidTuple("Source component/streamId for Tuple not part of streams being joined : " + stream, tuple);
    } catch (InvalidTuple e) {
        collector.ack(tuple);
        LOG.warn("{}. Tuple will be dropped.",  e.toString());
    }
}
 
开发者ID:hortonworks,项目名称:streamline,代码行数:24,代码来源:RealtimeJoinBolt.java


示例5: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
/**
 * Expect to receive either a tick tuple or a telemetry message that needs applied
 * to a profile.
 * @param input The tuple.
 */
@Override
public void execute(Tuple input) {
  try {
    if(TupleUtils.isTick(input)) {
      handleTick();

    } else {
      handleMessage(input);
    }

  } catch (Throwable e) {
    LOG.error(format("Unexpected failure: message='%s', tuple='%s'", e.getMessage(), input), e);
    collector.reportError(e);

  } finally {
    collector.ack(input);
  }
}
 
开发者ID:apache,项目名称:metron,代码行数:24,代码来源:ProfileBuilderBolt.java


示例6: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
public void execute(Tuple input) {
    if (TupleUtils.isTick(input)) {
        collector.ack(input);
        return;
    }
    try {
        Command cmd = (Command) input.getValueByField(Constants.EmitFields.COMMAND);
        BoltCommandHandler handler = handlerManager.getHandler(cmd);
        handler.handle(input);
        this.collector.ack(input);
    } catch (Exception e) {
        this.collector.ack(input);
        logger.error("Heartbeat error, ignore this error", e);
    }
}
 
开发者ID:BriData,项目名称:DBus,代码行数:16,代码来源:DbusHeartBeatBolt.java


示例7: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
@Override
public void execute(Tuple tuple) {
  //如果是TickTuple(则说明该Tuple触发了时间窗口),则将当前时间窗口的计数和实际的时间窗口长度emit。
  if (TupleUtils.isTick(tuple)) {
    LOG.debug("Received tick tuple, triggering emit of current window counts");
    emitCurrentWindowCounts();
  }
  else {
    countObjAndAck(tuple);
  }
}
 
开发者ID:Paleozoic,项目名称:storm_spring_boot_demo,代码行数:12,代码来源:RollingCountBolt.java


示例8: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
/**
 * This method functions as a template method (design pattern).
 */
@Override
public final void execute(Tuple tuple, BasicOutputCollector collector) {
  if (TupleUtils.isTick(tuple)) {
    getLogger().debug("Received tick tuple, triggering emit of current rankings");
    emitRankings(collector);
  }
  else {
    updateRankingsWithTuple(tuple);
  }
}
 
开发者ID:Paleozoic,项目名称:storm_spring_boot_demo,代码行数:14,代码来源:AbstractRankerBolt.java


示例9: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @param tuple the tuple to process.
 */
@Override
public void execute(final Tuple tuple) {
    if (TupleUtils.isTick(tuple)) {
        onTickTuple(tuple);
    } else {
        process(tuple);
    }
}
 
开发者ID:hortonworks,项目名称:streamline,代码行数:14,代码来源:BaseTickTupleAwareRichBolt.java


示例10: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @param tuple the tuple to process.
 */
@Override
public void execute(final Tuple tuple) {
  if (TupleUtils.isTick(tuple)) {
    onTickTuple(tuple);
  } else {
    process(tuple);
  }
}
 
开发者ID:twitter,项目名称:heron,代码行数:14,代码来源:BaseTickTupleAwareRichBolt.java


示例11: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
@Override
public void execute(Tuple tuple) {
  if (TupleUtils.isTick(tuple)) {
    LOG.debug("Received tick tuple, triggering emit of current window counts");
    emitCurrentWindowCounts();
  }
  else {
    countObjAndAck(tuple);
  }
}
 
开发者ID:ziyunhx,项目名称:storm-net-adapter,代码行数:11,代码来源:RollingCountBolt.java


示例12: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
@Override
public void execute(Tuple input) {
    if (TupleUtils.isTick(input)) {
        collector.ack(input);
        return;
    }
    try {
        if (producer != null) {
            // a message key can be provided in the mapper
            Message msg = pulsarBoltConf.getTupleToMessageMapper().toMessage(input);
            if (msg == null) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("[{}] Cannot send null message, acking the collector", boltId);
                }
                collector.ack(input);
            } else {
                final long messageSizeToBeSent = msg.getData().length;
                producer.sendAsync(msg).handle((r, ex) -> {
                    synchronized (collector) {
                        if (ex != null) {
                            collector.reportError(ex);
                            collector.fail(input);
                            LOG.error("[{}] Message send failed", boltId, ex);

                        } else {
                            collector.ack(input);
                            ++messagesSent;
                            messageSizeSent += messageSizeToBeSent;
                            if (LOG.isDebugEnabled()) {
                                LOG.debug("[{}] Message sent with id {}", boltId, msg.getMessageId());
                            }
                        }
                    }

                    return null;
                });
            }
        }
    } catch (Exception e) {
        LOG.error("[{}] Message processing failed", boltId, e);
        collector.reportError(e);
        collector.fail(input);
    }
}
 
开发者ID:apache,项目名称:incubator-pulsar,代码行数:45,代码来源:PulsarBolt.java


示例13: execute

import org.apache.storm.utils.TupleUtils; //导入依赖的package包/类
@Override
public void execute(Tuple input) {
    _collector.ack(input);

    // this bolt can be connected to anything
    // we just want to trigger a new search when the input is a tick tuple
    if (!TupleUtils.isTick(input)) {
        return;
    }

    Status[] slist = new Status[] { Status.DISCOVERED, Status.ERROR,
            Status.FETCH_ERROR, Status.FETCHED, Status.REDIRECTION };

    MultiSearchRequestBuilder multi = connection.getClient()
            .prepareMultiSearch();

    // should be faster than running the aggregations
    // sent as a single multisearch
    for (Status s : slist) {
        SearchRequestBuilder request = connection.getClient()
                .prepareSearch(indexName).setTypes(docType).setFrom(0)
                .setSize(0).setExplain(false);
        request.setQuery(QueryBuilders.termQuery("status", s.name()));
        multi.add(request);
    }

    long start = System.currentTimeMillis();

    MultiSearchResponse response = multi.get();

    long end = System.currentTimeMillis();

    LOG.info("Multiquery returned in {} msec", end - start);

    for (int i = 0; i < response.getResponses().length; i++) {
        SearchResponse res = response.getResponses()[i].getResponse();
        long total = res.getHits().getTotalHits();
        latestStatusCounts.put(slist[i].name(), total);
    }

}
 
开发者ID:DigitalPebble,项目名称:storm-crawler,代码行数:42,代码来源:StatusMetricsBolt.java



注:本文中的org.apache.storm.utils.TupleUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RefreshAdminAclsRequest类代码示例发布时间:2022-05-22
下一篇:
Java NetworkTopologyWithNodeGroup类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap