简体   繁体   中英

How could the storm bolt receive multiple type tuple from different spout or other bolt?

我有两个可序列化的类A和B。并且有两种喷头A_spout和B_spout。每个喷头都发出并行类以栓接C。但是在执行方法方面,元组没有什么区别,那么如何区分它们呢?

Each input Tuple in Bolt.execute() carries some meta data which also contains the input operator it originates from:

public void execute(Tuple input) {
    if(input.getSourceComponent().equals("A_Spout")) {
        // do something
    } else {
        // data from B_Spout; do something different
    }
}

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