Streaming enabled- To use Flow hooks and Custom Error

Hi,

As per streaming indicates

"With streaming enabled, we strongly recommend you do not attach policies that require access to the request or response payload. Those types of policies will either cause errors or trigger buffering in the API proxy, which limits payload size to the numbers listed above and defeats the purpose of enabling streaming to handle large payloads."

1. PreFlow Flow Hooks for Spike Arrest. Can be used because this is not under mediation policy

2. Custom Fault handling on response which verifies certain condition of response using Extract and Assign policy, hopefully this will have issues and need to be avoided with Streaming ?

Solved Solved
0 3 193
1 ACCEPTED SOLUTION

You're correct on both counts, with one little caveat

Spike Arrest does not involve accessing the request payload, unless you specify the <Identifier> attribute to apply different spike arrest counts to different apps, developers, etc, and that Identifier (indirectly) references the payload. For instance:

<Identifier ref="app_name"/>

In this case, the variable app_name cannot be extracted (in a previous step) from the payload, as that step would fail.

View solution in original post

3 REPLIES 3

You're correct on both counts, with one little caveat

Spike Arrest does not involve accessing the request payload, unless you specify the <Identifier> attribute to apply different spike arrest counts to different apps, developers, etc, and that Identifier (indirectly) references the payload. For instance:

<Identifier ref="app_name"/>

In this case, the variable app_name cannot be extracted (in a previous step) from the payload, as that step would fail.

@deboraelkin

For second case I am trying to give more details.

For the situation of Fault Handling (which have condition to customize the error for user)

I am extracting the content with Extract variable which is less than 10 MB (which is the response, I get from Backend for Faulty situation). Off course, I have enabled Streaming but exception or issues may not happen in such cases because response (from backend) in my case is less than 10 MB for Fault situation . Please confirm my understanding?

I get around 14MB + data only in ideal success condition hence had to enable the Streaming. (but in Success condition my Fault condition will not be satisfied ) but not sure in such cases also will have issues.. ?? to verify the condition etc.. or still streaming enabled ?

To my knowledge Exception will only occur with either request or response crossing more than 10 MB (equal to 10 MB may still have no impact with Mediation Policy) even if the Streaming is enabled.Correct ?

Please confirm my understanding.

Yes, you're correct. If you're evaluating whether an exception has occurred or not without examining the payload (eg: checking on the HTTP status code the backend returned), then it should work. If that condition is true, then the payload will be smaller and you should be fine to examine its contents.

If that condition is false, then you'd never look at the payload.