Skip to content

Commit 66d65f4

Browse files
committed
Reapply "Use ack, not message-id for acking/nacking to support activemq classic"
This reverts commit 15f7373.
1 parent 8ef1f88 commit 66d65f4

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

stompman/subscription.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,24 @@ async def _run_handler(self, *, frame: MessageFrame) -> None:
4949
try:
5050
await self.handler(frame)
5151
except self.suppressed_exception_classes as exception:
52-
if self._should_handle_ack_nack and self.id in self._active_subscriptions:
52+
if (
53+
self._should_handle_ack_nack
54+
and self.id in self._active_subscriptions
55+
and (ack_id := frame.headers["ack"])
56+
):
5357
await self._connection_manager.maybe_write_frame(
54-
NackFrame(
55-
headers={"id": frame.headers["message-id"], "subscription": frame.headers["subscription"]}
56-
)
58+
NackFrame(headers={"id": ack_id, "subscription": frame.headers["subscription"]})
5759
)
5860
self.on_suppressed_exception(exception, frame)
5961
else:
60-
if self._should_handle_ack_nack and self.id in self._active_subscriptions:
62+
if (
63+
self._should_handle_ack_nack
64+
and self.id in self._active_subscriptions
65+
and (ack_id := frame.headers["ack"])
66+
):
6167
await self._connection_manager.maybe_write_frame(
6268
AckFrame(
63-
headers={"id": frame.headers["message-id"], "subscription": frame.headers["subscription"]},
69+
headers={"id": ack_id, "subscription": frame.headers["subscription"]},
6470
)
6571
)
6672

0 commit comments

Comments
 (0)