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

Feat: AMQP module #68

Merged
merged 8 commits into from
Mar 18, 2024
Merged

Feat: AMQP module #68

merged 8 commits into from
Mar 18, 2024

Conversation

bradleytrf
Copy link
Contributor

@bradleytrf bradleytrf commented Mar 14, 2024

@bradleytrf
Copy link
Contributor Author

313009717-407f9f29-6971-4c05-8b08-e75f50f587cb 313009891-31ca9060-7507-4458-9b0e-1a5b058c2184

@bradleytrf
Copy link
Contributor Author

Screenshot 2024-03-15 at 08 23 12 tested on google rabbitmq

@bradleytrf
Copy link
Contributor Author

Screenshot 2024-03-18 at 09 32 32

Comment on lines +159 to +160
await channel.default_exchange.publish(
Message(body=serialized_output_message), routing_key=self._queue_name
Copy link
Member

@chiragjn chiragjn Mar 18, 2024

Choose a reason for hiding this comment

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

I see we have restricted ourselves to default exchange and re-using queue name as routing key
Shouldn't the exchange name and routing key be distinct inputs?
Maybe not today but some day in future?


afaik, for publishing we don't need queue name, just the exchange + routing key
What queue is bound to what exchange and routing key is not needed by us when publishing
See: https://aio-pika.readthedocs.io/en/latest/rabbitmq-tutorial/4-routing.html#bindings

Comment on lines +99 to +101
await channel.default_exchange.publish(
Message(body=serialized_input_message), routing_key=self._queue_name
)
Copy link
Member

@chiragjn chiragjn Mar 18, 2024

Choose a reason for hiding this comment

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

exchange name and routing key should be configurable
Maybe not today but some day in future?

Same reason as this: #68 (comment)
We don't need the queue name directly to publish

Copy link
Member

Choose a reason for hiding this comment

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

Another question - Is it always guaranteed that a routing key = X always delivers to a queue named X?

url: constr(
regex=r"^(?:amqp|amqps):\/\/(?:([^:/?#\s]+)(?::([^@/?#\s]+))?@)?([^/?#\s]+)(?::(\d+))?\/?([^?#\s]*)?(?:\?(.*))?$"
)
queue_name: str
Copy link
Member

Choose a reason for hiding this comment

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

Ideally this should be

Suggested change
queue_name: str
exchange_name: str
routing_key: str

Copy link
Member

@chiragjn chiragjn left a comment

Choose a reason for hiding this comment

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

I am approving the PR because it is in functional state
But we should sync offline and see if we want to refactor output config to take exchange and routing key instead of queue name

self, serialized_output_message: bytes, request_id: Optional[str]
):
channel = await self._get_channel()
await self._get_queue()
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this needed?

@akashg3627 akashg3627 merged commit 45bd3f1 into main Mar 18, 2024
5 checks passed
@akashg3627 akashg3627 deleted the TT-6142-AMQP branch March 18, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants