Skip to content

Commit

Permalink
fix: correct subject name
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik committed Aug 21, 2023
1 parent c20424a commit f6f6acb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions propan/brokers/nats/nats_js_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ async def publish(
message: SendableMessage,
subject: str,
*,
stream: Optional[str] = None,
headers: Optional[Dict[str, str]] = None,
reply_to: str = "",
callback: bool = False,
Expand All @@ -280,8 +281,11 @@ async def publish(
if reply_to:
raise WRONG_PUBLISH_ARGS

token = client._nuid.next()
token.extend(token_hex(2).encode())

future: asyncio.Future[Msg] = asyncio.Future()
sub = await client.subscribe(reply_to, future=future, max_msgs=1)
sub = await client.subscribe(token.decode(), future=future, max_msgs=1)
await sub.unsubscribe(limit=1)

if raise_timeout:
Expand All @@ -300,7 +304,7 @@ async def publish(
"content-type": content_type or "",
},
timeout=callback_timeout,
stream=self._stream_config.name,
stream=stream or self._stream_config.name,
)

if callback:
Expand Down

0 comments on commit f6f6acb

Please sign in to comment.