Skip to content

feat: Implement correlation on event filter#1386

Open
matheusandre1 wants to merge 5 commits into
serverlessworkflow:mainfrom
matheusandre1:feature/issue1206
Open

feat: Implement correlation on event filter#1386
matheusandre1 wants to merge 5 commits into
serverlessworkflow:mainfrom
matheusandre1:feature/issue1206

Conversation

@matheusandre1
Copy link
Copy Markdown
Contributor

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

@matheusandre1 matheusandre1 marked this pull request as ready for review May 18, 2026 21:56
@matheusandre1 matheusandre1 requested a review from fjtirado as a code owner May 18, 2026 21:56
Copilot AI review requested due to automatic review settings May 18, 2026 21:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Collaborator

@fjtirado fjtirado left a comment

Choose a reason for hiding this comment

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

You need to separate the DSL gap PR you were working on from the Correlation one.

@matheusandre1 matheusandre1 force-pushed the feature/issue1206 branch 2 times, most recently from d8d98e5 to 77143c1 Compare May 19, 2026 16:00
@matheusandre1 matheusandre1 marked this pull request as draft May 19, 2026 16:00
@matheusandre1 matheusandre1 marked this pull request as ready for review May 19, 2026 16:01
Copilot AI review requested due to automatic review settings May 19, 2026 16:01
@matheusandre1 matheusandre1 marked this pull request as draft May 19, 2026 16:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Comment thread impl/test/src/test/java/io/serverlessworkflow/impl/test/CorrelationTest.java Outdated
Comment thread impl/test/src/test/java/io/serverlessworkflow/impl/test/CorrelationTest.java Outdated
Comment thread impl/test/src/test/java/io/serverlessworkflow/impl/test/CorrelationTest.java Outdated
@matheusandre1
Copy link
Copy Markdown
Contributor Author

@fjtirado I will send the other file separately after you review this one.

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/CollectionConversionUtils.java Outdated
Copilot AI review requested due to automatic review settings May 22, 2026 15:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

Copilot AI review requested due to automatic review settings May 23, 2026 01:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings May 25, 2026 19:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

- 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>
dependabot Bot added 3 commits May 26, 2026 08:50
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>
Copilot AI review requested due to automatic review settings May 26, 2026 12:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Comment on lines +67 to +79
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));
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How is this compiling at all?

Copy link
Copy Markdown
Contributor Author

@matheusandre1 matheusandre1 May 26, 2026

Choose a reason for hiding this comment

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

How is this compiling at all?

Import above, right? , line 32

Comment thread impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowMutableInstance.java Outdated
Copy link
Copy Markdown
Collaborator

@fjtirado fjtirado left a comment

Choose a reason for hiding this comment

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

@matheusandre1 Please remove changes in WorkflowMutalbeInstance, we are almost there!!!

Signed-off-by: Matheus André <matheusandr2@gmail.com>
Comment thread pom.xml
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are the changes of version in these three poms intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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?

@fjtirado
Copy link
Copy Markdown
Collaborator

@matheusandre1 You need to remove the three commits that bump the versions

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.

Feat: Implement correlation on event filter

3 participants