Parallel/Async processing in a proxy

I would like to know what is the most efficient way to implement an API Proxy execution, where the Proxy in additional to other policies that it executes, needs to send the request/response to kafka. Both the request payload and response payload needs to be published after massaging the data.

How can the step for - "the request payload and response payload published to kafka after massaging the data" - can be executed asynchronously without impacting the Proxy flow of routing the request to the target and responding back to the client.

0 4 437
4 REPLIES 4

Try MessageLogging to send data to a fluentd process, which can then forward to a kafka endpoint. You can include a MessageLogging policy in the PostClientFlow .

Or, if you can't get that to work (don't have fluentd maybe), then look at using an asynchronous ServiceCallout in the Response flow.

Thanks Dino for taking the time to clarify this.

I need to log the response payload(after data massaging), along with the time related flow variables, which requires a js to do that ? PostClient Flow doesnot seem to support js.

also, donot have fluentd, but logstatsh can do the same ?

Yes, PostClientFLow supports ONLY message logging policy.

But you can use JS policy in any flow and the flow variables will be available in the PostClientFlow.

Moreover, this is why we use PostClientFlow, all time-related variables are available here.

Thank you