[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ship compiled code with broadcast stream ?

You should not try sending the compiled code anywhere but you can use it from within the processor.

You can do the same thing with the jar, you compile your jar, store it on HDFS. Send the jar path to the processor which can download the jar and instantiate the rule. No need to resubmit the job.


Maxim Parkachov <lazy.gopher@xxxxxxxxx> ezt írta (időpont: 2018. okt. 9., K, 15:08):

This is certainly possible. What you can do is use a BroadcastProcessFunction where you receive the rule code on the broadcast side.

Yes, this part works, no problem.
You probably cannot send newly compiled objects this way but what you can do is either send a reference to some compiled jars and load them with the URLClassloader or send the actual String code and invoke the java compiler from your function.
Compiling from source code ... actually, I can implement rules in nashorn _javascript_, but I'm pretty sure I'll get not serializable exception, but I'll check this.

Referencing existing jar will not solve problem as I would need to re-submit job, which I want to avoid in the first place. I actually wanted exactly first scenario, send newly compiled objects.