APIGEE-API-ENGINEER practice question 20 of 25

You need to log certain data to a custom logging service while processing the response You want to avoid processing delays due to logging during the logic flow What should you do?

Full set: 126 questions
Answer options
A: Use a Node.JS target to implement a nonblocking call.
B: Attach a Message Logging policy to the Post Client Flow Correct answer
C: Implement a Java Extension Callout with a worker thread
D: Use an asynchronous Service Callout policy in your proxy (low as soon as you have enough data to log
Correct Answer:
B. Attach a Message Logging policy to the Post Client Flow
Explanation

The PostClientFlow is a unique processing stage in an Apigee proxy that executes after the response has been sent to the requesting client. Placing the Message Logging policy in this flow ensures that the logging operation is decoupled from the client-facing request-response transaction. This "fire-and-forget" mechanism is the standard and most efficient method for performing non-critical tasks, such as logging, without adding any latency to the client's perceived response time.

Why Incorrect

A. A Node.js target replaces the primary backend service; it is part of the critical path and not suitable for an auxiliary, non-blocking logging task.
C. While technically possible, implementing a Java Callout with a custom worker thread is overly complex and not the idiomatic Apigee solution for this common requirement.
D. A Service Callout, even when asynchronous, still executes within the main proxy flow before the response is sent, potentially consuming resources and adding complexity to the primary logic. ---

References

1. Google Cloud Apigee Documentation

"Message Logging policy": "This policy is particularly useful in the PostClientFlow

which is executed after the response has been sent to the requesting client. By using the policy in this flow

you can be sure that the logging will not slow down the response time for the client."

Source: https://cloud.google.com/apigee/docs/api-platform/reference/policies/message-logging-policy

Section: "When to use this policy".

2. Google Cloud Apigee Documentation

"Configuring flows": "The PostClientFlow is the only flow that is executed after the proxy sends the response back to the client app. This flow is ideal for logging and for collecting analytics data... because this logic will not add latency to the response time seen by the client app."

Source: https://cloud.google.com/apigee/docs/api-platform/fundamentals/flow-variables-policies

Section: "PostClientFlow".

3. Google Cloud Apigee Documentation

"Adding a Node.js target": "When you add a Node.js target to a proxy

the Node.js application runs instead of the TargetEndpoint's element." This confirms that a Node.js target is a replacement for the backend

not a side process for logging.

Source: https://cloud.google.com/apigee/docs/api-platform/develop/adding-nodejs-api-proxy

Section: "Adding a Node.js target".

Scroll to Top