You could emit an extra boolean field to distinguish the two cases.

From: Navin Ipe [mailto:[email protected]]
Sent: dinsdag 24 mei 2016 12:52
To: [email protected]
Subject: Distinguishing between streams in an ack() or fail()

Hi,
In my spout, I'm emitting a string as the messageID and under some conditions, 
I'm also emitting a stream with an ArrayList of strings as the tuple.

if (something) {
collector.emit(new Values(stringTuples), somestring);//tuples, messageID
} else {
collector.emit("streamName1", new Values(anArrayList));
}
Is there an inbuilt way in ack(Object msgId) to distinguish between the ack of 
streamName1 vs the default stream? Because msgId will have to be cast into 
either a String or an ArrayList.
The only way I can think of it now, is to use a try-catch. Try for String 
casting. If an exception is thrown, catch it and cast as ArrayList.
Is this the best way?

--
Regards,
Navin

Reply via email to