Callbacks or Promises between Java and Lucee

Just wondering if anyone knows whether it is possible to instantiate a Java class and pass it a Lucee function as a callback, or alternatively whether it is possible to call a method in a Java class, have it return a Java Promise/Future, and have the resolved Promise be available in Lucee.

I’ve seen both Simon Hooker and Sean Corfeld’s CFML Promises/Futures libraries:

GitHub - SimonHooker/lucee-promise: Javascript style promises dressed up as a Lucee 5 extension https://github.com/SimonHooker/lucee-promise

GitHub - seancorfield/avowal: Futures and Promises for modern CFML, inspired by my earlier cfconcurrency library https://github.com/seancorfield/avowal

but I am wondering whether it is possible to implement something that goes between Java and Lucee.

I think the best way is to return a Promise from Java and resolve/reject it, but I would love to know what others have done.

Robert

bumpOn Wednesday, September 21, 2016 at 5:59:30 PM UTC-6, Robert Munn wrote:

Just wondering if anyone knows whether it is possible to instantiate a
Java class and pass it a Lucee function as a callback, or alternatively
whether it is possible to call a method in a Java class, have it return a
Java Promise/Future, and have the resolved Promise be available in Lucee.

I’ve seen both Simon Hooker and Sean Corfeld’s CFML Promises/Futures
libraries:

GitHub - SimonHooker/lucee-promise: Javascript style promises dressed up as a Lucee 5 extension

GitHub - seancorfield/avowal: Futures and Promises for modern CFML, inspired by my earlier cfconcurrency library

but I am wondering whether it is possible to implement something that goes
between Java and Lucee.

I think the best way is to return a Promise from Java and resolve/reject
it, but I would love to know what others have done.

Robert

Hi there,

Could you give an example of what you are trying to achieve? I mean can’t
you just instantiate the Java class within Lucee and use it within a
closure, essentially catch the return from the java class within a promise
to return something promiseyOn Thursday, 22 September 2016 00:59:30 UTC+1, Robert Munn wrote:

Just wondering if anyone knows whether it is possible to instantiate a
Java class and pass it a Lucee function as a callback, or alternatively
whether it is possible to call a method in a Java class, have it return a
Java Promise/Future, and have the resolved Promise be available in Lucee.

I’ve seen both Simon Hooker and Sean Corfeld’s CFML Promises/Futures
libraries:

GitHub - SimonHooker/lucee-promise: Javascript style promises dressed up as a Lucee 5 extension

GitHub - seancorfield/avowal: Futures and Promises for modern CFML, inspired by my earlier cfconcurrency library

but I am wondering whether it is possible to implement something that goes
between Java and Lucee.

I think the best way is to return a Promise from Java and resolve/reject
it, but I would love to know what others have done.

Robert