Skip to content

Commit eb2deba

Browse files
committed
Clarify how advisors are ordered in the reference doc
1 parent 1ee9094 commit eb2deba

File tree

1 file changed

+7
-7
lines changed
  • spring-ai-docs/src/main/antora/modules/ROOT/pages/api

1 file changed

+7
-7
lines changed

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/advisors.adoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,20 @@ The execution order of advisors in the chain is determined by the `getOrder()` m
6262

6363
* Advisors with lower order values are executed first.
6464
* The advisor chain operates as a stack:
65-
** The first advisor in the chain is the last to process the request.
66-
** It is also the first to process the response.
65+
** The first advisor in the chain is the first to process the request.
66+
** It is also the last to process the response.
6767
* To control execution order:
68-
** Set the order close to `Ordered.HIGHEST_PRECEDENCE` to ensure an advisor is executed first in the chain (last for request processing, first for response processing).
69-
** Set the order close to `Ordered.LOWEST_PRECEDENCE` to ensure an advisor is executed last in the chain (first for request processing, last for response processing).
68+
** Set the order close to `Ordered.HIGHEST_PRECEDENCE` to ensure an advisor is executed first in the chain (first for request processing, last for response processing).
69+
** Set the order close to `Ordered.LOWEST_PRECEDENCE` to ensure an advisor is executed last in the chain (last for request processing, first for response processing).
7070
* Higher values are interpreted as lower priority.
7171
* If multiple advisors have the same order value, their execution order is not guaranteed.
7272

7373
[NOTE]
7474
====
7575
The seeming contradiction between order and execution sequence is due to the stack-like nature of the advisor chain:
76-
* An advisor with the highest precedence (lowest order value) is added to the bottom of the stack.
77-
* It will be the last to process the request as the stack unwinds.
78-
* It will be the first to process the response as the stack rewinds.
76+
* An advisor with the highest precedence (lowest order value) is added to the top of the stack.
77+
* It will be the first to process the request as the stack unwinds.
78+
* It will be the last to process the response as the stack rewinds.
7979
====
8080

8181
As a reminder, here are the semantics of the Spring `Ordered` interface:

0 commit comments

Comments
 (0)