Skip to content

Commit 57f1885

Browse files
authored
Fix applying broker middleware to publisher (#104)
1 parent a9f1acd commit 57f1885

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/faststream-stomp/faststream_stomp/publisher.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from faststream.broker.publisher.usecase import PublisherUsecase
1212
from faststream.broker.types import AsyncCallable, BrokerMiddleware, PublisherMiddleware
1313
from faststream.exceptions import NOT_CONNECTED_YET
14-
from faststream.types import AsyncFunc, SendableMessage
14+
from faststream.types import SendableMessage
1515

1616

1717
class StompProducerPublishKwargs(TypedDict):
@@ -77,8 +77,7 @@ async def publish(
7777
) -> None:
7878
assert self._producer, NOT_CONNECTED_YET # noqa: S101
7979

80-
call: AsyncFunc = self._producer.publish
81-
80+
call = self._producer.publish
8281
for one_middleware in chain(
8382
self._middlewares[::-1], # type: ignore[arg-type]
8483
(
@@ -87,9 +86,8 @@ async def publish(
8786
),
8887
):
8988
call = partial(one_middleware, call) # type: ignore[operator, arg-type, misc]
90-
await self._producer.publish(
91-
message=message, destination=self.destination, correlation_id=correlation_id, headers=headers or {}
92-
)
89+
90+
return await call(message, destination=self.destination, correlation_id=correlation_id, headers=headers or {})
9391

9492
async def request( # type: ignore[override]
9593
self, message: SendableMessage, *, correlation_id: str | None = None, headers: dict[str, str] | None = None

0 commit comments

Comments
 (0)