0

I have been experimenting with various features of Micronaut. I have couple of questions.

1) I have 2 asynchronous calls to various API. How do I combine the results of 2 API's as we do in RxJava Observable.zip?

2) I am using declarative clients to connect to API. How do I catch the exceptions in such scenarios? In Netflix Feign Client, We use FallBack Factory. How do I do the same in Micronauts.

1 Answers1

0

One solution could be -

If both APIs can be called in parallel and are exclusive, use can leverage the Java 9 feature 'Completeable Future' and join the records once the results are available.

However, this is pure java APIs and not much related to micronaut framework.

Regarding using micronaut declarative client, you can have an option to catch HttpClientException.

If you want more further classification for failures of your API , you can use HttpClientResponseException and annotate your declarative client with proper error response body from API using field errorType.

How to map errorType using Micronaut client annotation