Salesforce-MuleSoft-Developer-II Practice Test
60 Questions
A Mule implementation uses a HTTP Request within an Unit Successful scope to connect to an API. How should a permanent error response like HTTP:UNAUTHORIZED be handle inside Until Successful to reduce latency?
A. Configure retrying until a MULERETRY_EXHAUSTED error is raised or the API responds back with a successful response.
B. In Until Successful configuration, set the retry count to 1 for error type HTTP: UNAUTHORIZED.
C. Put the HTTP Request inside a try scope in Unit Successful.
In the error handler, use On Error Continue to catch permanent errors like HTTP
UNAUTHORIZED.
D. Put the HTTP Request inside a try scope in Unit Successful.
In the error handler, use On Error Propagate to catch permanent errors like HTTP
UNAUTHORIZED.
In the error handler, use On Error Continue to catch permanent errors like HTTP UNAUTHORIZED.
Explanation:
To reduce latency when handling a permanent error response like HTTP:UNAUTHORIZED in a Mule implementation using an Until Successful scope, the best approach is:
✅ C. Put the HTTP Request inside a try scope in Until Successful. In the error handler, use On Error Continue to catch permanent errors like HTTP:UNAUTHORIZED.
Why HTTP:UNAUTHORIZED should not be retried: HTTP:UNAUTHORIZED (401) is a permanent error, indicating that the request lacks valid authentication credentials. Retrying the same request without modifying the credentials will not resolve the issue and will only increase latency due to unnecessary retries.
Why use a Try Scope with On Error Continue: Placing the HTTP Request inside a Try scope within the Until Successful scope allows you to handle errors explicitly. Using On Error Continue for HTTP:UNAUTHORIZED ensures that the flow continues without retrying the request, as this error is not transient. This approach minimizes latency by avoiding futile retry attempts and allows the flow to proceed with alternative logic (e.g., logging, fallback, or response handling).
❌ Why not the other options:
A. Configure retrying until a MULE:RETRY_EXHAUSTED error is raised or the API responds back with a successful response: This approach would cause the Until Successful scope to keep retrying the request, even for a permanent error like HTTP:UNAUTHORIZED. This increases latency unnecessarily, as the error will not resolve without changing the credentials.
B. In Until Successful configuration, set the retry count to 1 for error type HTTP:UNAUTHORIZED: While setting a low retry count reduces the number of attempts, it still introduces unnecessary retries for a permanent error. It’s better to avoid retries altogether for HTTP:UNAUTHORIZED.
D. Put the HTTP Request inside a try scope in Until Successful. In the error handler, use On Error Propagate to catch permanent errors like HTTP:UNAUTHORIZED: Using On Error Propagate will propagate the error up the flow, potentially stopping the Until Successful scope or the entire flow. This does not allow the flow to continue gracefully, which is often undesirable for handling permanent errors like HTTP:UNAUTHORIZED.
How it works in Mule:
➤ The Until Successful scope retries the enclosed logic for transient errors until a success condition is met or the retry limit is exhausted.
➤ By wrapping the HTTP Request in a Try scope and configuring an On Error Continue handler for HTTP:UNAUTHORIZED, you can catch the error, handle it (e.g., log it or return a custom response), and allow the flow to proceed without retrying the failed request.
➤ This approach ensures minimal latency by avoiding unnecessary retries for permanent errors while still allowing the Until Successful scope to handle transient errors appropriately.
Reference:
MuleSoft Documentation: Error Handling and Until Successful Scope
Salesforce-MuleSoft-Developer-II Practice-Test - Home | Previous |
Page 6 out of 60 Pages |