Open yan-v opened 2 years ago
You don't typically want to use .block()
, so I would suggest trying to asynchronously handle the problem and eliminate the need to block. If you have a Mono or Flux, there are methods on them to have things run in sequence. Like then()
(and other then*
methods). The first mono will run, then the next one will run. The flatMap()
method is also quite handy as you can trigger some other action and flatten the results.
You mentioned Service creation, and we do have some helper utils in the tests which are an example of how you can create some of these objects in a sequence but not resort to blocking, see here. The service instance integration tests also have some examples, see here.
Hope that helps!
Hi, Daniel, thanks a lot for such detailed and prompt response! I have a chain of some actions to do where each step failure not necessarily means a failure for my flow, i.e. if instance exists it is ok by me and i want to continue to service key creation, but want print the error. using onError makes duplicate code. I expected to have return object to contain the error instead of Exception handling.
Thank you again!
Yan
Hi guys, I need to perform several commands synchronously and return the response, but all commands after block return 'null', for instance:
CreateServiceInstanceResponse createServiceInstanceResponse = cloudFoundryOperations.services().createInstance(serviceInstanceRequestObj).cast(CreateServiceInstanceResponse.class).block();
As I see in CF, the command blocks and waits to Service Instance creation, but at the end the 'createServiceInstanceResponse' object is null.
Is this code incorrect or this is a bug?
Thank you in advance, Yan