You can implement your own backtype.storm.spout.MultiScheme where in backtype.storm.spout.MultiScheme.deserialize(byte[]) allows you to convert your data in required object. However you also need to register the class for serialisation using backtype.storm.Config.registerSerialization(Class) which will dynamically serialize your class.
To set schema to spout spoutConfig.scheme = new MultiSchemeImpl(); From: Ankur Garg <[email protected]<mailto:[email protected]>> Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Date: Wednesday, 16 September 2015 7:07 pm To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>, "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: Emitting Custom Object as Tuple from spout Hi , I am new to apache Storm . To understand it I was looking at storm examples provided in the storm tutorial ( https://github.com/apache/storm/tree/master/examples/storm-starter) . In all the examples , we are emitting prmitive types (String,int etc) as Tuples . In my use case I am having a Java Object which i want to emit as tuple to bolts . I am not sure how to do it . It seems I have to implement a custom Tuple producer to convert java Object to Values . Can anyone provide me some example how to do that : For ex my Java Object is : class Bean { int A ; String B; Bean2 b; //setters and getters } and Class Bean2 { //Some Attributes } Now , in my nextTuple() method for Spout , I have an instance of Bean object . How do I translate into Tuple and emit it and consume it through my bolt. Any ideas please. Thanks ankur
