Field routesToCache inner class AdaptCachedBodyGlobalFilter maybe should be modified
Describe. I noticed that it's a good way to use AdaptCachedBodyGlobalFilter to cache request body in the scenario of reuse.And I see it listening a EnableBodyCachingEvent event to judge whether or not to cache the request body.As a result, the field routesToCache will only have the entries with true value.I also notice the RetryGatewayFilterFactory use the event.Once I configure the routes with retry filter, the route will have the feature with caching request body permanently.I can't stop the behavior by revise the configuration in configuration center which support hot loading by refreshing routes.
private ConcurrentMap<String, Boolean> routesToCache = new ConcurrentHashMap<>();
@Override
public void onApplicationEvent(EnableBodyCachingEvent event) {
this.routesToCache.putIfAbsent(event.getRouteId(), true);
}
Describe the solution you'd like I think AdaptCachedBodyGlobalFilter should support one more event such as DisableBodyCachingEvent to set/delete the entry in routesToCache.
+1 for DisableBodyCachingEvent.
In our scenario, routes can have a metadata flag that enables or disables caching for that specific route. So if the route is added via the actuator API with enabled: true and then updated with enabled: false there is no way to update routesToCache.