you can specify the "ranking", "prioritisation" or "order" (called different things in different places) using this:
@ServiceRanking(-200)
The give the following situation:
600 : class com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet (id: 2255, property: service.ranking=600); called: 23; time: 97ms; time/call: 4217µs
0 : class com.adobe.aem.graphql.sites.ui.admin.impl.FeatureToggleFilter (id: 1373, property: none); called: 0; time: 122ms; time/call: -1µs
which is run first, the filter with 600, or the one with zero as the raking order?
so does
a) FormsHandlingServlet fitler call FeatureToggleFilter
or
b) FeatureToggleFilter call FormsHandlingServlet
The documentation says:
Filter ordering is defined by the filter.order property whose default value is Integer.MAX_VALUE where smaller values have higher priority over higher values.
This would imply b), but most people think its a).
Solved! Go to Solution.
Views
Replies
Total Likes
Due to conflicting documentation, I added debug statements to see what was happening. the answer is in fact a), so it appears that @SantoshSai could be wrong, and @arunpatidar could be right, at least for the current AEM cloud local dev environment.
Hi @TB3dock ,
They invoked in order of their service ranking, that is lowest to highest. service ranking status can be found here: https://sling.apache.org/documentation/bundles/models.html#available-injectors
Hope that helps!
Regards,
Santosh
Unfortunately, this is opposite to what @arunpatidar is saying?
Please check
service.ranking |
Integer |
0 |
Any Integer value |
Indication of where to place the filter in the filter chain. The higher the number the earlier in the filter chain. This value may span the whole range of integer values. Two filters with equal service.ranking property value (explicitly set or default value of zero) will be ordered according to their service.id service property as described in section 5.2.5, Service Properties, of the OSGi Core Specification R 4.2. |
Please note that the ordering is actually depending on the used Apache Sling Engine bundle version. Version older than 2.3.4 of that bundle are sorting the filters in the wrong reverse order. Make sure to run a newer version of the Sling engine to get the correct ordering (see also SLING-2920).
Unfortunately, this is opposite to what @SantoshSai is saying?
FYI, we are using cloud AEM, so presumably we dont have any say in which sling version is used.
Due to conflicting documentation, I added debug statements to see what was happening. the answer is in fact a), so it appears that @SantoshSai could be wrong, and @arunpatidar could be right, at least for the current AEM cloud local dev environment.
Views
Likes
Replies