Skip to content
Advertisement

Can we get parallel processing of each of Multi pipeline steps?

Lets say we have:

  • a list of URLs, that is a source for our Multi
  • as a first step we grab HTML of this page using HTTP client call
  • then we try to find some specific tag and grab its content
  • then we store things we found into database

Now we have a 3 steps here. Is there a way how these steps can be run in parallel? I mean after some time it should: grab HTML and simultaneously processing html + getting tags content and also simultaneously saving data into database from item that was processed already.(hopefully its obvious what I mean here) This way we can have parallel processing. As default, what I can see, mutiny does it in serial manner.

Here is an example:

JavaScript

Now this reports following console output:

JavaScript

One can see that its not running in parallel. What did I miss here?

Advertisement

Answer

As @jponge mentioned, you can collect your items in some List<Uni<String>> and then call

JavaScript

one more note here – if you are going to make HTTP calls, better add

JavaScript

since you don’t want to block Netty threads waiting for http calls to complete

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement