Can TIBCO API Exchange Gateway return 'Retry-After' header?
book
Article ID: KB0073215
calendar_today
Updated On:
Products
Versions
TIBCO API Exchange
2.x and above
Description
#Usecase - Throttle limits are configured in the APIX-G configuration - By default APIX-G returns "HTTP-429 Too Many Requests" response when the throttle limit is hit.
#Requirement The request is to have APIX-G return the "Retry-After" header as well in the error response.
Issue/Introduction
This article provides samples for the above usecase with TIBCO API Exchange Gateway(APIX-G)
Environment
All Supported Platforms
Resolution
For this a transformation set in FaultReportXSLT field on the Facade Operation can be used.
Please refer to attached archive: - "mera240" is the sample config - "fault_set_status-code_TextPayload.xsl" is the xsl where the custom header and response are returned by APIX-G in case of rate limit error - sample logs with and withou the stylesheet are also attached.
Please note that this is just sample provided as-is and should be tested thoroughly and modified yourself as required.
#Notes - Please note that this stylesheet can work-off of asg-error-code/message only. - The actual throttle counter, limits etc are not available in the context for use in transformations - However such entries are available in the engine log file though: ------------- 2021 Jul 13 16:24:56:121 GMT -4 13JulCore Info [HTTP-NIO-Worker-1-2] - [user] [core-class] DEBUG: Applying throttle RT_3perMin 2021 Jul 13 16:24:56:121 GMT -4 13JulCore Info [HTTP-NIO-Worker-1-2] - [user] [core-class] INFO: Current count for rate throttle RT_3perMin increased to 2 max count 3 ........... ...... 2021 Jul 13 16:24:58:257 GMT -4 13JulCore Info [HTTP-NIO-Worker-1-4] - [user] [core-class] ERROR: Throttle limit reached for rate throttle RT_3perMinthrottle key Current count: 4 -------------
Attachments
Can TIBCO API Exchange Gateway return 'Retry-After' header?
get_app