In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you what the structure of tuple in storm is, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Storm uses tuple as its data model. Each tuple is a pile of values, each value has a name, and each value can be of any type. In my understanding, a tuple can be seen as a java object with no methods. Overall, storm supports all basic types, strings, and byte arrays as value types for tuple. You can also use your own defined types as value types, as long as you implement the corresponding serializer (serializer).
A Tuple represents a basic processing unit in a data flow, such as an cookie log, which can contain multiple Field, each Field representing an attribute.
Tuple is supposed to be a Map of Key-Value, but since the field names of the tuple passed between components have been defined in advance, the Tuple only needs to fill in each Value in order, so it is a Value List.
An unbounded, continuous, continuous Tuple sequence makes up Stream.
Each node in the topology must define each field of the tuple it wants to emit. For example, the following bolt defines that the tuple it emits contains two fields of type double and triple.
Public class DoubleAndTripleBolt implements IRichBolt {
Private OutputCollector _ collector
@ Override
Public void prepare (Map conf, TopologyContext context, OutputCollector collector) {
_ collector = collector
}
@ Override
Public voide xecute (Tuple input) {
Int val = input.getInteger (0)
_ collector.emit (input,new Values (val*2, val*3))
_ collector.ack (input)
}
@ Override
Public void cleanup () {
}
@ Override
Public void declareOutputFields (OutputFieldsDeclarer declarer) {
Declarer.declare (newFields ("double", "triple"))
}
}
The declareOutputFields method defines the fields to output: ["double", "triple"].
The above is all the content of the article "what is the structure of tuple in storm?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.