Skip to content

Commit

Permalink
Moreeeee warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldygg committed Nov 8, 2024
1 parent 6f3c10c commit 770864f
Showing 1 changed file with 85 additions and 2 deletions.
87 changes: 85 additions & 2 deletions faststream/nats/subscriber/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,91 @@ def _validate_input_for_misconfigure(
)

if not stream:
# TODO: add shared warnings for Core / ObjWatch / KvWatch cases
pass
if obj_watch is not None:
if idle_heartbeat is not None:
warnings.warn(
"`idle_heartbeat` has no effect for ObjectValue subscriber. It can be used with JetStream (Pull/Push) - only.",
RuntimeWarning,
stacklevel=4,
)

if flow_control is not None:
warnings.warn(
"`flow_control` has no effect for ObjectValue subscriber. It can be used with JetStream (Pull/Push) - only.",
RuntimeWarning,
stacklevel=4,
)

if deliver_policy is not None:
warnings.warn(
"`deliver_policy` has no effect for ObjectValue subscriber. It can be used with JetStream (Pull/Push) - only.",
RuntimeWarning,
stacklevel=4,
)

if headers_only is not None:
warnings.warn(
"`headers_only` has no effect for ObjectValue subscriber. It can be used with JetStream (Pull/Push) - only.",
RuntimeWarning,
stacklevel=4,
)

elif kv_watch is not None:
if idle_heartbeat is not None:
warnings.warn(
"`idle_heartbeat` has no effect for KeyValue subscriber. It can be used with JetStream (Pull/Push) - only.",
RuntimeWarning,
stacklevel=4,
)

if flow_control is not None:
warnings.warn(
"`flow_control` has no effect for KeyValue subscriber. It can be used with JetStream (Pull/Push) - only.",
RuntimeWarning,
stacklevel=4,
)

if deliver_policy is not None:
warnings.warn(
"`deliver_policy` has no effect for KeyValue subscriber. It can be used with JetStream (Pull/Push) - only.",
RuntimeWarning,
stacklevel=4,
)

if headers_only is not None:
warnings.warn(
"`headers_only` has no effect for KeyValue subscriber. It can be used with JetStream (Pull/Push) - only.",
RuntimeWarning,
stacklevel=4,
)
else:
if idle_heartbeat is not None:
warnings.warn(
"`idle_heartbeat` has no effect for Core subscriber. It can be used with JetStream (Pull/Push) - only.",
RuntimeWarning,
stacklevel=4,
)

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

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

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

if obj_watch is not None:
# KeyStorage watch
Expand Down

0 comments on commit 770864f

Please sign in to comment.