boot icon indicating copy to clipboard operation
boot copied to clipboard

Pass ex-info in/out pods

Open arichiardi opened this issue 9 years ago • 5 comments

Hi boot-ers!

Often, when working with tasks or pods that need to exchange info, we all have the restriction on the data we can send.

Fortunately @Deraen has already thought about this and it might make sense to actually include the two functions in boot.util as standard way for accomplishing this task (if I am not mistaken there are tests as well).

I can take care of this, also because I will need it in my other patch for boot-reload.

How does it sound?

Btw thanks for working on boot!

arichiardi avatar Dec 27 '16 07:12 arichiardi

That serialize/deserialize implementation is not completely transparent, and I'd be a bit concerned about it being included in Boot.

It doesn't keep the objects in ex-data, but converts them (some) to Strings as the objects can't be represented in EDN. Perhaps nippy or some other library would be better way to serialize ex-data but they aren't available in Boot and probably wouldn't handle all objects either.

For now I think it is best to just copy those utilities to tasks that need them, task developers can then check if the utilities work for for their use case.

Deraen avatar Dec 27 '16 11:12 Deraen

Ok thanks for pointing that out. For pod inter communication maybe a classic Java siralization would work now that I think of it (except for the data part). At the moment I copied, but it would be great to make the process easier in general.

arichiardi avatar Dec 27 '16 16:12 arichiardi

From slack @micha (not verbatim):

A possible solution would be to add ex-info handling to the alpha with-pod, currently implemented in xform.clj.

arichiardi avatar Dec 29 '16 18:12 arichiardi

Reopening given that a solution can be tried here.

arichiardi avatar Dec 29 '16 18:12 arichiardi

From Slack @micha

many of the clojure classes and interfaces are created dynamically at runtime so they're essentially gensyms as far as java is concerned like names in one pod do not correspond to the same objects as names in another pod including names like PersistentArrayMap or whatever or any of the protocols with-pod almost works with ex-infos

boot.user=> (.getMessage (with-pod p (ex-info "asdf" {:a 1}))) "asdf"

because it's returning a RuntimeException of course it doesn't implement IExceptionInfo in the calling pod it implements the IExceptionInfo interface in the callee pod so this doesn't work

boot.user=> (ex-data (with-pod p (ex-info "asdf" {:a 1}))) nil

arichiardi avatar Dec 29 '16 18:12 arichiardi