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

LinkByMetadata, LinkByCorrelationId, LinkByCausationId introduced #382

Merged
merged 9 commits into from
Jul 3, 2018

Conversation

paneq
Copy link
Member

@paneq paneq commented Jun 27, 2018

Issue: #221 #346

@paneq paneq added this to the v0.31 milestone Jun 29, 2018
@paneq paneq self-assigned this Jun 29, 2018
@paneq paneq changed the title [WIP] LinkByMetadata introduced LinkByMetadata, LinkByCorrelationId, LinkByCausationId introduced Jun 29, 2018
customer_id: 123,
order_id: "K3THNX9",
),
metadata: { city: "Chicago" }
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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])
Copy link
Member

Choose a reason for hiding this comment

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

Case sensitive?

Copy link
Member Author

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
Copy link
Member

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 :(

Copy link
Member Author

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)

Copy link
Member

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("_")
Copy link
Member

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 ;)

Copy link
Member Author

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 :)

Copy link
Member

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
Copy link
Member

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 :)

Copy link
Member Author

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 :)

@mpraglowski
Copy link
Member

Documentation missing. Maybe use version management to add it within this PR ?

@paneq
Copy link
Member Author

paneq commented Jul 2, 2018

@mpraglowski documentation added in a separate PR. It already contains metadata changes so I just increased the scope.

@paneq paneq merged commit 99787d8 into master Jul 3, 2018
@paneq paneq deleted the linking_metadata branch July 3, 2018 08:19
@paneq paneq mentioned this pull request Sep 7, 2021
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.

2 participants