-
Notifications
You must be signed in to change notification settings - Fork 8
feat: Replication filters #292
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
base: main
Are you sure you want to change the base?
Conversation
| return ReplicationFilterImpl.empty().removeRegion(region); | ||
| } | ||
|
|
||
| ReplicationFilter addRegion(String region); |
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.
would have been nice if the static method could have been named the same, but that's not possible with Java
|
|
||
| import akka.javasdk.impl.effect.ReplicationFilterImpl; | ||
|
|
||
| public interface ReplicationFilter { |
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 want to have this rather open for future additions of other types of filters, than regions.
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.
SDK side looking good so far
| keyValue = false) | ||
| keyValue = false, | ||
| replicationFilterEnabled = true | ||
| ) // FIXME how shall we enable it? Can we solve it without enable flag? |
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.
Enabling in the sense that a user opts in, or in the sense that the SDK supports it?
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.
"user opts in". By default we replicate to all regions, until the user defines a filter with regions. However, on the runtime side the filter mechanism is added at startup.
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 got that part about replicate everywhere by default, but this toggle, is this to say SDK supports it and then user opts in by defining filters, or this should be true/false based on user choice in entity definition/annotation something?
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.
My original thought was that the user would have to enable this for a specific entity. Could be an annotation or a method override. However, that is rather clunky and it would be better to enable by setting the replication filter in the effect, but that happens later. Not sure yet if we can get rid of this flag.
| } | ||
| for (String region : item.removeRegions()) { | ||
| filter = filter.removeRegion(region); | ||
| } |
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.
If we expect a lot of non-single add/remove (not sure we do), it would be nicer with prepared methods taking Collection<String>
|
|
||
| if (item.productId().isEmpty()) { | ||
| return effects() | ||
| .replicationFilter(filter) |
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.
Mismatch between persist which is imperative and replicationFilter, would be better if it was also imperative, even if longer, something like updateReplicationFilter or setReplicationFilter
2d7682d to
8e42c93
Compare
No description provided.