I have two Bolt class BoltX and BoltY. BoltY receives tuples from BoltX.
BoltX declares output with multiple fields, each tuple contains 4 strings:

class BoltX implements IBasicBolt {
    ...
    public void declareOutputFields(OutputFieldsDeclarer declarer) {
        declarer.declare(new Fields("A","B","C","D"));
    }}

In BoltY:

class BoltX implements IBasicBolt {
    boolean hasReceive = false;
    String A = null;
    String B = null;
    ...
    public void execute(Tuple input, BasicOutputCollector collector) {
        if (!hasReceive) {
            hasReceive = true;
            A = input.getString(0);
            B = input.getString(1);
        }

        if (!input.getString(0).equals(A) || !input.getString(1).equals(B)) {
            LOG.error("group error");
            return;
        }
        ...
    }
    ...}

In Topology:

...
builder.setBolt("x", new BoltX(), 3);
builder.setBolt("y", new Bolty(), 3).fieldsGrouping("x", new
Fields("A", "B"));...

I think that the output from x with same fields "A" and "B" will go to the
same task of BoltY.

However, the log of topology shows lots of "group error".

So how to group outputs with same fields "A" and "B" to the same task of
BoltY?

The question is also asked in
http://stackoverflow.com/questions/33512554/multiple-fields-grouping-in-storm

-- 
*Shuo Chen*
chenatu2...@gmail.com
chens...@whaty.com

Reply via email to