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

Publish to multiple RabbitMQ queues #5387

Merged
merged 24 commits into from
Mar 18, 2020
Merged

Publish to multiple RabbitMQ queues #5387

merged 24 commits into from
Mar 18, 2020

Conversation

ricwo
Copy link
Contributor

@ricwo ricwo commented Mar 6, 2020

Proposed changes:

Status (please check what you already did):

  • added some tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

Copy link
Contributor

@erohmensing erohmensing left a comment

Choose a reason for hiding this comment

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

Not sure if you wanted a code review from me bc you also requested tobi, but I had time, so figured id give some feedback.

I'll let him approve, but it looks pretty good to me

rasa/core/brokers/pika.py Show resolved Hide resolved
rasa/core/brokers/pika.py Show resolved Hide resolved
rasa/core/brokers/pika.py Show resolved Hide resolved
Comment on lines 56 to 60
("rasa_core_events", None, ["rasa_core_events"]), # default case
(["q1", "q2"], None, ["q1", "q2"]), # supplying a list for `queue` works too
("q1", "q2", ["q2"]), # `queues` arg supplied, takes precedence
("q1", ["q2", "q3"], ["q2", "q3"]), # same, but with a list
(None, "q1", ["q1"]), # only supplying `queues` works
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we want to assert something also about whether a UserWarning should be shown for each case

Copy link
Contributor

@erohmensing erohmensing Mar 10, 2020

Choose a reason for hiding this comment

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

can we also do a (None, None, ["rasa_core_events"]) case where the user didn't provide any queue(s) configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not really because that would override the default argument queues=("rasa_core_events",). I'll add (None, ["rasa_core_events"], ["rasa_core_events"]) though which is the default case

changelog/5258.improvement.rst Outdated Show resolved Hide resolved
@wochinge
Copy link
Contributor

I give it a review tomorrow

Copy link
Contributor

@wochinge wochinge left a comment

Choose a reason for hiding this comment

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

Great work, @ricwo ! Requesting changes since I think it should be a fanout exchange instead of the loop which we are using

changelog/5258.improvement.rst Outdated Show resolved Hide resolved
docs/api/event-brokers.rst Outdated Show resolved Hide resolved
docs/api/event-brokers.rst Outdated Show resolved Hide resolved
docs/api/event-brokers.rst Outdated Show resolved Hide resolved
rasa/core/brokers/broker.py Outdated Show resolved Hide resolved
rasa/core/brokers/pika.py Show resolved Hide resolved
rasa/core/brokers/pika.py Outdated Show resolved Hide resolved
rasa/core/brokers/pika.py Outdated Show resolved Hide resolved
tests/core/test_broker.py Outdated Show resolved Hide resolved
tests/core/test_broker.py Show resolved Hide resolved
@ricwo ricwo requested a review from wochinge March 16, 2020 17:07
Copy link
Contributor

@wochinge wochinge left a comment

Choose a reason for hiding this comment

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

Nice work 🚀

@@ -72,7 +73,7 @@ Here is how you add it using Python code:
pika_broker = PikaEventBroker('localhost',
'username',
'password',
queue='rasa_core_events')
queues=['rasa_events'])
Copy link
Contributor

Choose a reason for hiding this comment

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

let's better add this to the changelog. Could be that some people build on this default value 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

or is this only changed in the docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I deliberately only changed it in the docs for now - we still have rasa_core_events as the default for backwards compatibility. maybe update this in 2.0?

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good 👍 Should we create an issue for this?

rasa/cli/export.py Show resolved Hide resolved
Comment on lines 224 to 235
Attributes:
host: Pika host.
username: Username for authentication with Pika host.
password: Password for authentication with Pika host.
port: port of the Pika host.
queues: Pika queues to declare and publish to.
should_keep_unpublished_messages: Whether or not the event broker should
maintain a queue of unpublished messages to be published later in
case of errors.
raise_on_failure: Whether to raise an exception if publishing fails. If
`False`, keep retrying.
log_level: Logging level.
Copy link
Contributor

Choose a reason for hiding this comment

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

mhm, maybe the attributes should just not be public 😄 @alwx @chkoss @degiz @federicotdn Any preferences on the style for constructors?

rasa/core/brokers/pika.py Show resolved Hide resolved
rasa/core/brokers/pika.py Outdated Show resolved Hide resolved
@ricwo ricwo merged commit 043a92b into master Mar 18, 2020
@ricwo ricwo deleted the multiple-queues branch March 18, 2020 07:07
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.

Publish to multiple queues in RabbitMQ
3 participants