Spring boot rest api retry logic to third party api - spring-boot

We have one rest API, when we call it. It makes another third party rest API call.
So if third part gives failed response,
then we need to retry based on configuration count and if the error code matches with configured error code in yml.
I am thinking to use normal while loop to make retry and check if retry count and error code matches then retry.
Is this correct way? Does it impact the performance?
Thanks,
Ashwini

Related

API Gateway Proxy Integration. Return response of second lambda function

The premise is pretty simple.
The usual application flow is as follows:
API Gateway receives a request.
API Gateway triggers Lambda Function with parameters.
Lambda Function runs the logic.
The Lambda Function's response is automatically forwarded to API Gateway as the response to step 1 (Response to the Received API Request).
Here's the issue I'm having. I need to run two functions before returning the response to the received API request. I need the return statement from the second function in step 4 to be the response sent back
to the client.
Now there are more examples where this is necessary. In the future, we might need to run a few services (such as lambda > Lambda > PostgreSQL > API Response) before responding to the request.
Is there a way to receive a request from a client, then run a host of tasks, assemble the necessary data, then use this data as a response in the original API request? So far step-functions seemed a likely solution but I don't know if it can do this.
Until recently this would've been a pain with Step Functions but around re:invent time last year they announced the ability to orchestrate synchronous express workflows: https://aws.amazon.com/blogs/compute/new-synchronous-express-workflows-for-aws-step-functions/
IMO, this would be the best / easiest way to implement what you're looking for.

How to check Global HTTP batch endpoint is called

I received an email saying that JSON-RPC and Global HTTP Batch serving endpoints being discontinued, and that my project on Google Cloud Platform is calling Global HTTP Batch endpoint.
When I check the API dashboard of the project, however, "Google Cloud Storage JSON API" shows no usage for the last 30 days.
Does that mean the project no longer calls this endpoint?
If not (= if there is still a chance that we call this endpoint), how can I see whether a change that I will make to eliminate the call does actually eliminate the call?
If you are using a client from Google to make your request you are no longer calling the Global HTTP Batch endpoint as they have been updated to use the new API specific Batch endpoint.
You can still use the dev tools from your browser to check the request url from your app.

Want to call a Rest POST endpoint with retries using a circuitBreaker

I am running a test from job which makes a http POST submission to 3rd party REST endpoint and implemented retry using requestHandlerAdvice with backoffpolicy policy set as exponential. I was thinking is there a way to implement circuitBreaker with requestHandlerAdvice . The reason for this is if after couple of retries message fails , then circuit shall remain open and after some threshold when I retry with post request and I get a response, I will resume Post submissions to 3rd party REST endpoint
The framework provides both retry and circuit breaker advices.
Simply add both to the request handler advice chain.

Is it a good practice to invoke multiple rest calls in apache camel?

I have consider the following design for one the requirement
Camel Route listens(subscriber) to a jms(Topic) which has abstracted information.
Look up on the cache(Hazelcast) to get detail information go to 5
On cache failure, Invoke REST endpoints (can be multiple in sequence)
Parse response of REST endpoints to get detailed information and add it to cache
Dynamically route to other jms endpoint based on detailed information
I'm not sure whether implementing the above solution is a good practice or not please advice me.

Are database calls in cloud functions counted as regular request?

As per FAQs of parse.com,
How are requests made from Cloud Code treated under the request limit?
Calling a Cloud function will count itself as a single request. Save and delete triggers in Cloud Code are considered part of the original object save/delete request, and they will not be counted as an additional request. However, if your function or save/delete trigger uses the Parse JavaScript SDK to perform additional operations, these will be treated in the same way they would as if they were made by a regular client.
What does using JS sdk in cloud code exactly mean? If i make simple database call like query.find from a cloud function or trigger then will that be counted as regular client request?
Yes query.find will be a database request. Any query execution wil be.

Resources