Skip to content

Conversation

patriknw
Copy link
Contributor

No description provided.

@github-actions github-actions bot added documentation documentation related java-sdk labels Mar 13, 2025
return ReplicationFilterImpl.empty().removeRegion(region);
}

ReplicationFilter addRegion(String region);
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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.

@patriknw patriknw changed the title Wip replication filter patriknw feat: Replication filters Mar 14, 2025
Copy link
Contributor

@johanandren johanandren left a 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?
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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);
}
Copy link
Contributor

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)
Copy link
Contributor

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

@patriknw patriknw force-pushed the wip-replication-filter-patriknw branch from 2d7682d to 8e42c93 Compare April 7, 2025 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation documentation related java-sdk
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants