You can put the needed compiled classes in the directory: your topology's 
src/main/resources, then you package your topology with resources. If you 
submit the topology, storm will extract the needed the compiled classes to a 
directory which is in the worker's scope. So the spout/bolt can find the 
classes.

Regards
       John Fang


-----邮件原件-----
发件人: "Carlos Chávez" [mailto:ccha...@agssa.net] 
发送时间: 2016年3月10日 11:29
收件人: user@storm.apache.org
主题: Dynamic compiled object/classes and topology

Hi All.

I have some bolt that compile some classes from a string, my classes are in 
Scala and I use ToolBox to compile. The compile is done in the prepare method 
and that work fine. Then in the execute method I'm able to call the methods 
from this classes.

The thing is that compile the classes take some time mostly because there are 
many thread compiling the same set of classes. I was trying to reduce the time 
compiling of classes before summit the topology, I was able to pass the 
compiled objects to the bolt and when the bolt deserialize the object it throw 
the class not found error.

I suspect that when I submit the topology the compiled classes are not in 
scope, not sure if the class loader when submit the topology is reset or 
something.

So, is there a way to add this dynamic compiled object/classes to the topology 
at runtime?

----
Cheers.
Carlos Chávez.

Reply via email to