The use case includes using the 'Configure Message Streaming' assertion and validating the uploaded file. This will be done using the gateway as a proxy to route a streamed message to a backend application.
With the 'Configure Message Streaming' assertion in the policy, the following error is observed:
Problem routing to http://10.xxx.xxx.xxx:8080/v1/xxx. Error msg: Unable to obtain HTTP response from http://10.xxx.xxx.xxx:8080/v1/xxx: Unable to read stream: the specified maximum data size limit would be exceeded
The Broadcom Communities space (https://community.broadcom.com/communities/community-home/digestviewer/viewthread?MID=8004690) has good info around the understanding of message streaming but there isn't much detail about validation. The desired results can be achieved with and without the streaming assertion.
Expected Behaviour: While using the 'Configure Message Streaming’ assertion, you should be able to upload the file to the backend via the GW with a value that is less than what is specified in the io.xmlPartMaxBytes cluster-wide property (as this is streaming).
All supported versions of the API Gateway
Large data sent over HTTP is sent in chunks. Each received chunk must be less than the io.xmlPartMaxBytes. The 'Configure Message Streaming' assertion reduces latency/memory as the message body received by the GW is not processed (made available in the policy). The size limit of a “request object/message body”, even in the case of streaming, will be enforced by the routing assertion. A working example would be a client sending a large file (1GB) in 16MB chunks and the the GW io.xmlPartMaxBytes is greater than 16,000,000 Bytes. The request message body will not be processed and routed to the backend.
The io.xmlPartMaxBytes CWP must be set to a larger value to meet the message size requirement. With streaming, the io.xmlPartMaxBytes value is still checked before routing and that size needs to be larger than the chunked size of the message.
When the io.xmlPartMaxBytes is larger than the message size, there will be no error.
-ANOTHER USE CASE-
A user has the following settings on their Gateway:
- Cluster-Wide Property (CWP) "io.xmlPartMaxBytes" is set to "500000"
- the policy contains a "Limit Message Size" assertion which is set to 20000 KBytes
- When sending a request with ~2.5 MB text directly in the body (i.e. no attachment) the request fails
with the following response: "Unable to read stream: the specified maximum data size limit would be exceeded".
- "Perform WS-Security processing for this service" is disabled
According to the following knowledge base article, the limit message size assertion should overrule the io.xmlPartMaxBytes setting, which is not the case in the above use case scenario.
1. If the request is larger than the CWP value. It will "fail" at the CWP value, this failure will essentially allow a blank message through after verifying the message size. From how the code was written, this seems intentional. Internally, the rate limit assertion does not fail with an incorrect value.
Two scenarios:
a. If the request is larger than CWP and larger than the assertion then the assertion will fail because of the request size.
b. If the request is larger than CWP and smaller than the assertion then the assertion will fail because it will cross-reference with the CWP.
Essentially it verifies if there is an existing error with the size, then fails.
2. As a result of the failure of the CWP. The message will not be processed but there will be a recorded error for other assertions to reference.