-
Notifications
You must be signed in to change notification settings - Fork 125
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
LinkByMetadata, LinkByCorrelationId, LinkByCausationId introduced #382
Conversation
customer_id: 123, | ||
order_id: "K3THNX9", | ||
), | ||
metadata: { city: "Chicago" } |
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 would prefer some mote "technical" example here to not encourage users to put business data into metadata.
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 your point. However I considered this to be a technical metadata, the location of an user responsible for this event :) So you can have a look what are the people from chicago doing to your system. Does that make sense?
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.
Chicago looks like "business" description of location. IP address would be perfectly fine here :)
) | ||
event_store.publish(ev) | ||
|
||
expect(event_store.read.stream("$by_city_Chicago").each.to_a).to eq([ev]) |
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.
Case sensitive?
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.
Good point. Yes. If that's not good enough for someone, they can write these 3 lines as a separate handler that transforms the data.
expect(event_store.read.stream("sweet+Paris").each.to_a).to eq([ev]) | ||
end | ||
|
||
specify "array of ids" do |
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.
It is not clear for me what is a purpose of that test. The description does not tell me much :(
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.
The point is that link_to_stream receives an array of ids instead of a single id (which also works but I believe accidentally rather than explicitly)
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.
Yeah I know, but it took me a while to understand that test.
) | ||
@event_store = event_store | ||
@key = key | ||
@prefix = prefix || ["$by", key, nil].join("_") |
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.
Clever way to add _
and the end of prefix ;)
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.
It was ""
but mutants says it works with nil as well :)
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.
👍
@@ -20,6 +21,7 @@ module RailsEventStore | |||
InvalidHandler = RubyEventStore::InvalidHandler | |||
InvalidPageStart = RubyEventStore::InvalidPageStart | |||
InvalidPageSize = RubyEventStore::InvalidPageSize | |||
CorrelatedCommands = RubyEventStore::CorrelatedCommands |
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 here? Seems not to be correlated with that PR :)
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 forgot to do it in the other PR :) it's slightly related via being about correlation :)
Documentation missing. Maybe use version management to add it within this PR ? |
@mpraglowski documentation added in a separate PR. It already contains metadata changes so I just increased the scope. |
Issue: #221 #346