File tree Expand file tree Collapse file tree
src/asyncapi_python/contrib/wire/amqp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -120,8 +120,18 @@ async def send_batch(
120120 address_override if address_override is not None else self ._routing_key
121121 )
122122
123- # Note: empty string is valid for default exchange routing
124- # All valid routing configurations should result in a non-None string at this point
123+ # Validate we have a destination
124+ # Fail ONLY if both are truly missing:
125+ # - address_override is None (not provided by caller)
126+ # - AND self._routing_key is "" (no static config was derived from channel/bindings/operation)
127+ # Note: empty string IS valid when explicitly configured (fanout exchanges, default exchange)
128+ if address_override is None and not self ._routing_key :
129+ raise ValueError (
130+ f"Cannot send: no routing destination available. "
131+ f"RPC replies require reply_to from the request, or the channel must "
132+ f"have address/bindings/operation-name to derive destination. "
133+ f"(address_override={ address_override } , routing_key={ self ._routing_key !r} )"
134+ )
125135
126136 for message in messages :
127137 amqp_message = AmqpMessage (
You can’t perform that action at this time.
0 commit comments