#Vertx - Provide data from previous compose results

1 messages · Page 1 of 1 (latest)

silent briar
#

Shot in the dark for anyone here that is familiar with vertx. 🙂


Anyone know if there a nice way to have compose() return multiple values? Or a nice way to provide data from a previous compose result?

Ideally i'd have code that would read like this

.compose(foo -> Future.succeededFuture(field1))
.compose(bar -> Future.succeededFuture(field2))
.compose([field1,field2] -> Future.succeededFuture(field3))
...

but im not sure if this is possible at first glance

mortal flumeBOT
#

<@&987246452180930620> please have a look, thanks.

mortal flumeBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

brazen latch
#

so, i dont really know any vertx, but essentially u want the second guy to not return field2 but a class that contains both

#

ideally u find a good name that fits ur domain

#

but since u didnt gave any details, ima just call it Pair for the example:

#
record Pair(Foo first, Foo second) {}

...

.compose(foo -> { ... return first; })
.compose(first ->  { ... return new Pair(first, second); })
.compose(pair -> ...)
#

theres not really any better or convenient way to piggyback other than actually creating classes/records for it

#

at least in java

silent briar
#

Gotcha, thanks a lot!