Skip to content

Commit

Permalink
Add warnings for nats core subscriber
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldygg committed Nov 9, 2024
1 parent 01c7e84 commit 09b58ce
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion faststream/nats/subscriber/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def _validate_input_for_misconfigure(
# Core Subscriber
if durable:
warnings.warn(
message="`durable` option has no effect for NATS Core Subscription. It can be used with JetStream (Pull/Push) - only.",
message="`durable` option has no effect for NATS Core Subscription. It can be used with JetStream (Pull) - only.",
category=RuntimeWarning,
stacklevel=4,
)
Expand All @@ -515,3 +515,45 @@ def _validate_input_for_misconfigure(
stacklevel=4,
)

if ordered_consumer:
warnings.warn(
message="`ordered_consumer` option has no effect for NATS Core Subscription. It can be used with JetStream Push - only.",
category=RuntimeWarning,
stacklevel=4,
)

if idle_heartbeat is not None:
warnings.warn(
message="`idle_heartbeat` option has no effect for NATS Core Subscription. It can be used with JetStream (Pull/Push) - only.",
category=RuntimeWarning,
stacklevel=4,
)

if flow_control:
warnings.warn(
message="`flow_control` option has no effect for NATS Core Subscription. It can be used with JetStream (Pull/Push) - only.",
category=RuntimeWarning,
stacklevel=4,
)

if deliver_policy:
warnings.warn(
message="`deliver_policy` option has no effect for NATS Core Subscription. It can be used with JetStream (Pull/Push) - only.",
category=RuntimeWarning,
stacklevel=4,
)

if headers_only:
warnings.warn(
message="`headers_only` option has no effect for NATS Core Subscription. It can be used with JetStream (Pull/Push) - only.",
category=RuntimeWarning,
stacklevel=4,
)

if ack_first:
warnings.warn(
message="`ack_first` option has no effect for NATS Core Subscription. It can be used with JetStream Push - only.",
category=RuntimeWarning,
stacklevel=4,
)

0 comments on commit 09b58ce

Please sign in to comment.