|
10 | 10 | overload,
|
11 | 11 | )
|
12 | 12 |
|
13 |
| -from typing_extensions import Doc, override |
| 13 | +from typing_extensions import Doc, deprecated, override |
14 | 14 |
|
15 | 15 | from faststream._internal.broker.abc_broker import ABCBroker
|
16 | 16 | from faststream._internal.constants import EMPTY
|
@@ -161,7 +161,13 @@ def subscriber(
|
161 | 161 | periodically committed in the background.
|
162 | 162 | """,
|
163 | 163 | ),
|
164 |
| - ] = True, |
| 164 | + deprecated( |
| 165 | + """ |
| 166 | + This option is deprecated and will be removed in 0.7.0 release. |
| 167 | + Please, use `ack_policy=AckPolicy.ACK_FIRST` instead. |
| 168 | + """, |
| 169 | + ), |
| 170 | + ] = EMPTY, |
165 | 171 | auto_commit_interval_ms: Annotated[
|
166 | 172 | int,
|
167 | 173 | Doc(
|
@@ -428,7 +434,13 @@ def subscriber(
|
428 | 434 | periodically committed in the background.
|
429 | 435 | """,
|
430 | 436 | ),
|
431 |
| - ] = True, |
| 437 | + deprecated( |
| 438 | + """ |
| 439 | + This option is deprecated and will be removed in 0.7.0 release. |
| 440 | + Please, use `ack_policy=AckPolicy.ACK_FIRST` instead. |
| 441 | + """, |
| 442 | + ), |
| 443 | + ] = EMPTY, |
432 | 444 | auto_commit_interval_ms: Annotated[
|
433 | 445 | int,
|
434 | 446 | Doc(
|
@@ -695,7 +707,13 @@ def subscriber(
|
695 | 707 | periodically committed in the background.
|
696 | 708 | """,
|
697 | 709 | ),
|
698 |
| - ] = True, |
| 710 | + deprecated( |
| 711 | + """ |
| 712 | + This option is deprecated and will be removed in 0.7.0 release. |
| 713 | + Please, use `ack_policy=AckPolicy.ACK_FIRST` instead. |
| 714 | + """, |
| 715 | + ), |
| 716 | + ] = EMPTY, |
699 | 717 | auto_commit_interval_ms: Annotated[
|
700 | 718 | int,
|
701 | 719 | Doc(
|
@@ -965,7 +983,13 @@ def subscriber(
|
965 | 983 | periodically committed in the background.
|
966 | 984 | """,
|
967 | 985 | ),
|
968 |
| - ] = True, |
| 986 | + deprecated( |
| 987 | + """ |
| 988 | + This option is deprecated and will be removed in 0.7.0 release. |
| 989 | + Please, use `ack_policy=AckPolicy.ACK_FIRST` instead. |
| 990 | + """, |
| 991 | + ), |
| 992 | + ] = EMPTY, |
969 | 993 | auto_commit_interval_ms: Annotated[
|
970 | 994 | int,
|
971 | 995 | Doc(
|
@@ -1130,7 +1154,23 @@ def subscriber(
|
1130 | 1154 | "SpecificationDefaultSubscriber",
|
1131 | 1155 | "SpecificationBatchSubscriber",
|
1132 | 1156 | ]:
|
1133 |
| - if ack_policy is AckPolicy.ACK_FIRST: |
| 1157 | + if ( |
| 1158 | + auto_commit is not EMPTY and auto_commit |
| 1159 | + and ack_policy is not EMPTY and ack_policy is not ack_policy.ACK_FIRST |
| 1160 | + ) or ( |
| 1161 | + auto_commit is not EMPTY and not auto_commit |
| 1162 | + and ack_policy is ack_policy.ACK_FIRST |
| 1163 | + ): |
| 1164 | + msg = "You can't use conflict settings ('auto_commit' and 'ack_policy')" |
| 1165 | + raise SetupError(msg) |
| 1166 | + |
| 1167 | + if auto_commit is not EMPTY and auto_commit and ack_policy is EMPTY: |
| 1168 | + ack_policy = AckPolicy.DO_NOTHING |
| 1169 | + |
| 1170 | + elif auto_commit is not EMPTY and not auto_commit and ack_policy is EMPTY: |
| 1171 | + ack_policy = AckPolicy.REJECT_ON_ERROR |
| 1172 | + |
| 1173 | + elif ack_policy is AckPolicy.ACK_FIRST: |
1134 | 1174 | auto_commit = True
|
1135 | 1175 | ack_policy = AckPolicy.DO_NOTHING
|
1136 | 1176 |
|
|
0 commit comments