Skip to content

Commit

Permalink
Pass correct arguments to wrapped function
Browse files Browse the repository at this point in the history
  • Loading branch information
gverm committed Feb 1, 2024
1 parent 85ab86b commit 8819a9a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "amqpstorm-flask"
version = "0.1.7"
version = "0.1.8"
description = "amqpstorm library for Flask"
readme = "README.md"
authors = [{ name = "Inuits", email = "[email protected]" }]
Expand Down
14 changes: 6 additions & 8 deletions src/amqpstorm_flask/RabbitMQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,12 @@ def _publish_to_channel(
properties=properties,
)

def __create_wrapper_function(self, f):
def wrapper_function(
message, consumer_tag, channel, body, envelope, properties
):
def __create_wrapper_function(self, routing_key, f):
def wrapper_function(message):
f(
routing_key=envelope.routing_key,
body=body,
message_id=properties.message_id,
routing_key=routing_key,
body=message.body,
message_id=message.message_id,
)

return wrapper_function
Expand Down Expand Up @@ -207,7 +205,7 @@ def new_consumer():
arguments=queue_arguments,
)
self.channel.basic.qos(prefetch_count=1)
wrapped_f = self.__create_wrapper_function(f)
wrapped_f = self.__create_wrapper_function(routing_key, f)
self.channel.basic.consume(
wrapped_f, queue=queue_name, no_ack=self.queue_params.no_ack
)
Expand Down

0 comments on commit 8819a9a

Please sign in to comment.