Skip to content

Commit

Permalink
Pass body as json to wrapped function
Browse files Browse the repository at this point in the history
  • Loading branch information
gverm committed Feb 1, 2024
1 parent b0e3699 commit d17ea80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 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.9"
version = "0.2.0"
description = "amqpstorm library for Flask"
readme = "README.md"
authors = [{ name = "Inuits", email = "developers@inuits.eu" }]
Expand Down
8 changes: 6 additions & 2 deletions src/amqpstorm_flask/RabbitMQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def __create_wrapper_function(self, routing_key, f):
def wrapper_function(message):
f(
routing_key=routing_key,
body=message.body,
body=message.json(),
message_id=message.message_id,
)

Expand Down Expand Up @@ -221,7 +221,11 @@ def new_consumer():
if retries > max_retries:
exit(0)

self.logger.exception(ex)
self.logger.exception(
"An error occurred while consuming queue %s: %s",
queue_name,
ex,
)
self.logger.warning(f"Retrying in {retry_delay} seconds...")
sleep(retry_delay)

Expand Down

0 comments on commit d17ea80

Please sign in to comment.