-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add sepia routing keys to eiffellib #37
Conversation
Add a routing_key property for events. Deprecate the routing_key argument for RabbitMQPublisher
if version is not None: | ||
self.version = version | ||
self.family = family | ||
self.tag = tag | ||
self.domain_id = domain_id |
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.
Should this also affect meta.source.domainId
?
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 don't know.. Should we also add meta.source.domainId
to this automatically in that case?
Do we want implicit behavior?
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.
Implicit isn't bad if documented :-) I'd say that meta.source.domainId
and the domain token in the routing key should match each other in the normal case. As a library user I'd be annoyed if I'd have to pass the domain in the constructor but also modify the meta
object by hand.
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.
We will now add event.domain_id
to meta.source.domainId
if it's set.
It will also add RabbitMQPublisher.source.domainId
to event.domain_id
if event.domain_id
is the default value of "_".
I.e. event.domain_id
will always take precedence over RabbitMQPublisher.source.domainId
if set
This method will set the source on all events if there is a source | ||
added to the :obj:`RabbitMQPublisher`. | ||
If the routing key is set to None in the :obj:`RabbitMQPublisher` this | ||
method will use the routing key from the event that is being sent. | ||
The event domainId will also be added to `meta.source` if it is set to | ||
anything other than the default value. If there is no domainId | ||
set on the event, then the domainId from the source in the | ||
:obj:`RabbitMQPublisher` will be used in the routing key, with a default | ||
value taken from the :obj:`eiffellib.events.eiffel_base_event.EiffelBaseEvent`. |
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.
Please help me with this documentation. I am not sure if this is clear enough.
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 think the description is clear, but the interface is pretty complicated. Maybe we're giving people too much rope with a source attribute in the publisher, but I'm sure it's convenient since the source is typically the same.
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.
We use that part heavily in ETOS, so it would have a big impact to remove it.
We could of course deprecate it and rework ETOS to add it to all events ETOS publishes, but I kind of like having it here.
This method will set the source on all events if there is a source | ||
added to the :obj:`RabbitMQPublisher`. | ||
If the routing key is set to None in the :obj:`RabbitMQPublisher` this | ||
method will use the routing key from the event that is being sent. | ||
The event domainId will also be added to `meta.source` if it is set to | ||
anything other than the default value. If there is no domainId | ||
set on the event, then the domainId from the source in the | ||
:obj:`RabbitMQPublisher` will be used in the routing key, with a default | ||
value taken from the :obj:`eiffellib.events.eiffel_base_event.EiffelBaseEvent`. |
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 think the description is clear, but the interface is pretty complicated. Maybe we're giving people too much rope with a source attribute in the publisher, but I'm sure it's convenient since the source is typically the same.
Applicable Issues
fixes: #36
Description of the Change
Add a routing_key property for events.
Deprecate the routing_key argument for RabbitMQPublisher
Alternate Designs
We could also add the routing key arguments to the "send_event" method in the RabbitMQPublisher instead, however I felt like this was something that the events should handle.
Benefits
We would follow sepia and allow for more fine grained control of what to receive in Subscribers.
Possible Drawbacks
This is, potentially, a breaking change for some people
Sign-off
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
Signed-off-by: Tobias Persson [email protected]