简体   繁体   中英

Pass output fields through a bolt of Apache Storm

在我的Bolt(扩展了BaseBasicBolt)的函数declareOutputFields中,有没有一种简单的方法来声明我从先前的Bolt或Spout接收到的相同字段?

No. This is not possible.

Spouts and Bolt are basically completely decoupled and only connected when assembling a topology. Thus, each Spout/Bolt must independently from its input, define the output schema.

I found an interesting way to deal with this problem. Note that this solution is not really matching my question because what I wanted to do is not really convenient to Storm guide rules, as Matthias Sax explained.

What I finally do is I ask fields in the constructor of my bolt. This way the fields I want to pass trough my bolt are given in my topology. This allow the user of the bolt to have more control on what come in and out of the bolt.

I think this is way more relevant than trying to pass everything like a mirror.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM