Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature rabbitmq as message broker #27

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

manudiv16
Copy link

No description provided.

Copy link
Owner

@akhundMurad akhundMurad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing! 👍



class RabbitMQMessageBroker:
def __init__(self, client, *, routing_key: str | None = None, exchange: str | None = None) -> None:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please define the type of client argument


async def send_message(self, message: Message) -> None:
async with self._connection as connection:

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to build a message here and the pass it to the basic_publish or publish

@@ -12,3 +12,17 @@ def redis_client() -> redis.Redis:
@pytest.fixture()
def redis_message_broker(redis_client: redis.Redis) -> RedisMessageBroker:
return RedisMessageBroker(client=redis_client, channel_prefix="test_diator_channel")

@pytest.fixture()
async def rabbitmq_client() -> aio_pika.Connection:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to use:
https://testcontainers-python.readthedocs.io/en/latest/rabbitmq/README.html - for RabbitMQ
https://testcontainers-python.readthedocs.io/en/latest/redis/README.html - for Redis

As a result, there will be no need for the docker-compose.

@akhundMurad akhundMurad added the enhancement New feature or request label Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants