-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
await channel.default_exchange.publish( | ||
Message(body=serialized_output_message), routing_key=self._queue_name |
There was a problem hiding this comment.
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
await channel.default_exchange.publish( | ||
Message(body=serialized_input_message), routing_key=self._queue_name | ||
) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this should be
queue_name: str | |
exchange_name: str | |
routing_key: str |
There was a problem hiding this 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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed?
https://truefoundry.atlassian.net/browse/TT-6142