Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
#191: add main logic for EidGeneratorStrategy #192
base: master
Are you sure you want to change the base?
#191: add main logic for EidGeneratorStrategy #192
Changes from 2 commits
e57ac5f
7eafb87
2eb8d38
203304a
61e04d7
911e388
59f396a
882e60d
793c58a
79421d6
1a49e50
6da7987
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 this line worked when you wrote it, but now it fails, as EventLog doesn't have the generated equals method anymore, so it just does the
==
comparison.I'd just revert this line of the change.
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 changed
equalTo
toMatchers.samePropertyValuesAs
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've expanded the test to make sure it's also working when inserting multiple events:
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.
Done
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 wonder whether we want to be more flexible here to allow for future extensions?
Like generating the UUID as a hash of the content?
Or a different one depending on the event type?
So my suggestion would be to have this method take some parameter(s) – either the EventLog object (though with the current approach this will be tricky, as it's only created afterwards) or the values that go into it (i.e. eventType, payload, compactionKey).
The two implementations we provide can just ignore these parameters, but if someone needs something specialized, we don't have to do another incompatible change.
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 thought about that, I would prefer to use payload object for generation eid, but because we have just Object value I decided do nothing with that.
Added in last commit:
generateEid
call to the end createEventLog methodPersonally I not so much like this solution, because it a little bit tricky and depends on what time we initialise
eid
field.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.
On a deeper thought, this breaks the package layering a bit. The
*.impl
packages (EventLog
is part of it) should not be exposed in the user interface of the library (i.e. the EidGeneratorStrategy).So that only leaves the second option of "take all the values which go into the EventLog", which makes the signature a bit unwieldly.
I think now that it should be possible to retrofit this also later – we can for now have just the no-argument abstract
generateEid
method in the interface, and later add adefault
method with more parameters, which will then be called by the library. The few applications which need a data-specific eid can overwrite this method, applications which have some other non-data-specific need can implement the abstract method, and the big majority of applications can just use one of the pre-made implementations via the factory methods (or even auto-configuration).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.
Ok, I removed
EventLog
.I agree that we can add additional method later.
For some extra cases I extracted
EventLogBuilder
interface and clients can implement this and build EventLog as they needed