Storm sends a tuple every time

Source: Internet
Author: User

Ticktuple can meet every time a tuple is sent, "__system" component periodically sends a tuple of "__tick" stream to the task,

The sending frequency is configured by Topology_tick_tuple_freq_secs and can be configured in the Default.ymal,

It can also be configured in the code via Getcomponentconfiguration ().

The code is configured as follows

Public map<string, Object> getcomponentconfiguration () {
map<string, object> conf = new hashmap<string, object> ();
Conf.put (Config.topology_tick_tuple_freq_secs, 1); Interval 1s
return conf;
}

public static Boolean isticktuple (tuple tuple) {
Return Tuple.getsourcecomponent (). Equals (constants.system_component_id)//system_component_id = = "__system"
&& tuple.getsourcestreamid (). Equals (constants.system_tick_stream_id); system_tick_stream_id = = "__tick"
}

When the configuration is complete, storm will periodically send ticktuple to the task
The function of timing trigger can be completed only by Isticktuple to determine whether it is ticktuple.

Public final void execute (tuple tuple, basicoutputcollector basicoutputcollector) {

if (!isticktuple (tuple)) {}

}

Storm sends a tuple every time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.