I am using Mule 3.8. How do I set Content-Encoding: gzip in order to compress my payload, External_API accepts gzip compressed payload as input??
I am using until-successful in order to retry my http API call. I am not getting right documentation how to set gzip in http request so that payload will be compressed.
<flow name="Ingestion_with_retries_Flow" >
<until-successful objectStore-ref="objectStore" maxRetries="${max.retries}" deadLetterQueue-ref="Queue_Failed_Payload_To_ErrorDir_And_Notify"
failureExpression="#[(exception != null) and (exception.causedBy(java.net.ConnectException) || exception.causedBy(java.net.SocketTimeoutException) || exception.causedBy(java.net.SocketException) || exception.causedBy(java.io.IOException))]"
doc:name="Until Successful" millisBetweenRetries="${millis.between.retries}">
<processor-chain doc:name="Processor Chain">
<http:request config-ref="HTTPS_Ingestion_Service_External_API" path="/delivery" method="POST" doc:name="External API Data Delivery Post">
<http:request-builder>
<http:header headerName="Accept" value="${http.by.interface.version}"/>
</http:request-builder>
<http:success-status-code-validator values="200"/>
</http:request>
<json:xml-to-json-transformer doc:name="XML to JSON"/>
<flow-ref name="Subflow_Extract_Ingestion_Response" doc:name="Extract Ingestion Response"/>
</processor-chain>
</until-successful>
</flow>
Just use the compression module's Compress element to compress the input payload.
You can then set the input listener's response header to Content-Encoding=gzip. This lets the caller/browser know that the response payload is gzip encoded.