feat: Implement correlation on event filter#1386
Conversation
a138648 to
ba7cffc
Compare
fjtirado
left a comment
There was a problem hiding this comment.
You need to separate the DSL gap PR you were working on from the Correlation one.
d8d98e5 to
77143c1
Compare
77143c1 to
17ca1de
Compare
|
@fjtirado I will send the other file separately after you review this one. |
89bf4f0 to
a2e10ea
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
fluent/spec/src/main/java/io/serverlessworkflow/fluent/spec/AbstractEventFilterBuilder.java:51
- AbstractEventFilterBuilder always sets an EventFilterCorrelate instance on the filter in build(), even when correlate() was never called. This can change serialization output (emitting an empty correlate object) and, more importantly, can surface null-map cases downstream (e.g., engine code that assumes correlate.additionalProperties is non-null). Consider only setting correlate when at least one correlation entry was added, or ensure the correlate builder initializes an empty map so getters never return null.
protected final EventFilter filter = new EventFilter();
protected final EventFilterCorrelate correlate = new EventFilterCorrelate();
protected abstract SELF self();
protected abstract P newEventPropertiesBuilder();
public SELF with(Consumer<P> c) {
P pb = this.newEventPropertiesBuilder();
c.accept(pb);
filter.setWith(pb.build());
return self();
}
public SELF correlate(
String key, Consumer<? super AbstractListenTaskBuilder.CorrelatePropertyBuilder> c) {
AbstractListenTaskBuilder.CorrelatePropertyBuilder cb =
new AbstractListenTaskBuilder.CorrelatePropertyBuilder();
c.accept(cb);
correlate.setAdditionalProperty(key, cb.build());
return self();
}
public EventFilter build() {
filter.setCorrelate(correlate);
return filter;
}
a2e10ea to
bd8aedf
Compare
bd8aedf to
46186f9
Compare
46186f9 to
2fbc66a
Compare
- Add CorrelationPredicate for evaluating correlation expressions - Add correlate support in AbstractEventFilterBuilder and AbstractEventFilterSpec - Update TypeEventRegistration and TypeEventRegistrationBuilder with correlation predicates - Implement correlation matching in AbstractTypeConsumer - Add CorrelationTest and listen-correlate.yaml - Add correlate tests in WorkflowBuilderTest and DSLTest Signed-off-by: Matheus André <matheusandr2@gmail.com>
9558a7b to
4ffacf0
Compare
Bumps [net.thisptr:jackson-jq](https://github.com/eiiches/jackson-jq) from 1.6.1 to 1.6.2. - [Release notes](https://github.com/eiiches/jackson-jq/releases) - [Commits](eiiches/jackson-jq@1.6.1...1.6.2) --- updated-dependencies: - dependency-name: net.thisptr:jackson-jq dependency-version: 1.6.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps `version.org.junit.jupiter` from 6.0.3 to 6.1.0. Updates `org.junit.jupiter:junit-jupiter-api` from 6.0.3 to 6.1.0 - [Release notes](https://github.com/junit-team/junit-framework/releases) - [Commits](junit-team/junit-framework@r6.0.3...r6.1.0) Updates `org.junit.jupiter:junit-jupiter-engine` from 6.0.3 to 6.1.0 - [Release notes](https://github.com/junit-team/junit-framework/releases) - [Commits](junit-team/junit-framework@r6.0.3...r6.1.0) Updates `org.junit.jupiter:junit-jupiter-params` from 6.0.3 to 6.1.0 - [Release notes](https://github.com/junit-team/junit-framework/releases) - [Commits](junit-team/junit-framework@r6.0.3...r6.1.0) --- updated-dependencies: - dependency-name: org.junit.jupiter:junit-jupiter-api dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.junit.jupiter:junit-jupiter-engine dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.junit.jupiter:junit-jupiter-params dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps com.google.protobuf:protobuf-java-util from 4.34.1 to 4.35.0. --- updated-dependencies: - dependency-name: com.google.protobuf:protobuf-java-util dependency-version: 4.35.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
2d9953c to
8385343
Compare
| private Collection<CloudEventPredicate> buildCorrelationPredicates( | ||
| EventFilterCorrelate correlate, WorkflowApplication application) { | ||
| if (correlate == null) { | ||
| return List.of(); | ||
| } | ||
| Map<String, CorrelateProperty> additionalProperties = correlate.getAdditionalProperties(); | ||
| if (additionalProperties == null || additionalProperties.isEmpty()) { | ||
| return List.of(); | ||
| } | ||
| Collection<CloudEventPredicate> predicates = new ArrayList<>(); | ||
| for (Map.Entry<String, CorrelateProperty> entry : additionalProperties.entrySet()) { | ||
| predicates.add(CorrelationPredicate.from(entry.getKey(), entry.getValue(), application)); | ||
| } |
There was a problem hiding this comment.
How is this compiling at all?
There was a problem hiding this comment.
How is this compiling at all?
Import above, right? , line 32
There was a problem hiding this comment.
@matheusandre1 Please remove changes in WorkflowMutalbeInstance, we are almost there!!!
Signed-off-by: Matheus André <matheusandr2@gmail.com>
8385343 to
3a7f751
Compare
There was a problem hiding this comment.
Are the changes of version in these three poms intentional?
There was a problem hiding this comment.
Yes, It was a poorly done rebase on my part; I didn't perform a git push force, and then I had to cherry-pick your changes (I had never done that before).
There was a problem hiding this comment.
But the version is already <version.org.junit.jupiter>6.1.0</version.org.junit.jupiter> in main, can not you avoid this files appearing in the review?
|
@matheusandre1 You need to remove the three commits that bump the versions |
Many thanks for submitting your Pull Request ❤️!
What this PR does / why we need it: Closes: #1206
Special notes for reviewers:
Additional information (if needed):