@@ -297,15 +297,13 @@ async def _read_loop(self) -> None:
297297 break
298298
299299 match msg :
300- case ("MSG" , subject , sid , reply_to , payload ):
301- logger .debug (
302- "<<- MSG %s %s %s %s" , subject , sid , reply_to if reply_to else "" , len (payload )
303- )
304- await self ._handle_msg (subject , sid , reply_to , payload )
305- case ("HMSG" , subject , sid , reply_to , headers , payload , status_code , status_description ):
306- logger .debug ("<<- HMSG %s %s %s %s %s" , subject , sid , reply_to , len (headers ), len (payload ))
300+ case ("MSG" , subject , sid , reply , payload ):
301+ logger .debug ("<<- MSG %s %s %s %s" , subject , sid , reply if reply else "" , len (payload ))
302+ await self ._handle_msg (subject , sid , reply , payload )
303+ case ("HMSG" , subject , sid , reply , headers , payload , status_code , status_description ):
304+ logger .debug ("<<- HMSG %s %s %s %s %s" , subject , sid , reply , len (headers ), len (payload ))
307305 await self ._handle_hmsg (
308- subject , sid , reply_to , headers , payload , status_code , status_description
306+ subject , sid , reply , headers , payload , status_code , status_description
309307 )
310308 case ("PING" ,):
311309 logger .debug ("<<- PING" )
@@ -401,11 +399,11 @@ async def _write_loop(self) -> None:
401399 logger .exception ("Error during final flush" )
402400 return
403401
404- async def _handle_msg (self , subject : str , sid : str , reply_to : str | None , payload : bytes ) -> None :
402+ async def _handle_msg (self , subject : str , sid : str , reply : str | None , payload : bytes ) -> None :
405403 """Handle MSG from server."""
406404 if sid in self ._subscriptions :
407405 subscription = self ._subscriptions [sid ]
408- msg = Message (subject = subject , data = payload , reply_to = reply_to )
406+ msg = Message (subject = subject , data = payload , reply = reply )
409407
410408 for callback in subscription ._callbacks :
411409 try :
@@ -422,7 +420,7 @@ async def _handle_hmsg(
422420 self ,
423421 subject : str ,
424422 sid : str ,
425- reply_to : str ,
423+ reply : str ,
426424 headers : dict [str , list [str ]],
427425 payload : bytes ,
428426 status_code : str | None = None ,
@@ -438,7 +436,7 @@ async def _handle_hmsg(
438436 msg = Message (
439437 subject = subject ,
440438 data = payload ,
441- reply_to = reply_to ,
439+ reply = reply ,
442440 headers = Headers (headers ) if headers else None , # type: ignore[arg-type]
443441 status = status ,
444442 )
@@ -699,7 +697,7 @@ async def publish(
699697 subject : str ,
700698 payload : bytes ,
701699 * ,
702- reply_to : str | None = None ,
700+ reply : str | None = None ,
703701 headers : Headers | dict [str , str | list [str ]] | None = None ,
704702 ) -> None :
705703 """Publish a message to a subject."""
@@ -712,14 +710,14 @@ async def publish(
712710 command_parts = encode_hpub (
713711 subject ,
714712 payload ,
715- reply_to = reply_to ,
713+ reply = reply ,
716714 headers = headers_dict , # type: ignore[arg-type]
717715 )
718716 else :
719717 command_parts = encode_pub (
720718 subject ,
721719 payload ,
722- reply_to = reply_to ,
720+ reply = reply ,
723721 )
724722
725723 message_data = b"" .join (command_parts )
@@ -853,7 +851,7 @@ async def request(
853851
854852 sub = await self .subscribe (inbox )
855853 try :
856- await self .publish (subject , payload , reply_to = inbox , headers = headers )
854+ await self .publish (subject , payload , reply = inbox , headers = headers )
857855
858856 try :
859857 response = await asyncio .wait_for (sub .next (), timeout )
0 commit comments