From 868e23649135c5f77bf21846ff79d2bd9f303f6f Mon Sep 17 00:00:00 2001 From: Matheus Cruz Date: Mon, 19 Jan 2026 15:19:25 -0300 Subject: [PATCH 1/2] Apply minor adjustments to decorators Signed-off-by: Matheus Cruz --- .../impl/events/EmittedEventDecorator.java | 9 +++++++++ .../impl/executors/http/HttpExecutor.java | 4 ++-- .../impl/executors/http/RequestDecorator.java | 4 +--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/impl/core/src/main/java/io/serverlessworkflow/impl/events/EmittedEventDecorator.java b/impl/core/src/main/java/io/serverlessworkflow/impl/events/EmittedEventDecorator.java index 728b100d..7514d549 100644 --- a/impl/core/src/main/java/io/serverlessworkflow/impl/events/EmittedEventDecorator.java +++ b/impl/core/src/main/java/io/serverlessworkflow/impl/events/EmittedEventDecorator.java @@ -20,6 +20,15 @@ import io.serverlessworkflow.impl.TaskContext; import io.serverlessworkflow.impl.WorkflowContext; +/** + * Interface for decorating {@link CloudEventBuilder} objects. + * + *

Implementations should be loaded via ServiceLoader and are sorted by priority in ascending + * order (lower priority numbers executed first). Decorators are applied in sequence, where later + * decorators can override headers set by earlier decorators with the same header name. + * + * @see ServicePriority + */ public interface EmittedEventDecorator extends ServicePriority { void decorate( diff --git a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java index b237393f..6104160f 100644 --- a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java +++ b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java @@ -77,11 +77,11 @@ public CompletableFuture apply( Builder request = target.request(); for (RequestDecorator requestDecorator : requestDecorators) { - requestDecorator.decorate(request, workflow, taskContext, input); + requestDecorator.decorate(request, workflow, taskContext); } headersMap.ifPresent( - h -> h.apply(workflow, taskContext, input).forEach((k, v) -> request.header(k, v))); + h -> h.apply(workflow, taskContext, input).forEach(request::header)); return CompletableFuture.supplyAsync( () -> requestFunction.apply(request, uri, workflow, taskContext, input), workflow.definition().application().executorService()); diff --git a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/RequestDecorator.java b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/RequestDecorator.java index bf7ce631..67de21bf 100644 --- a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/RequestDecorator.java +++ b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/RequestDecorator.java @@ -38,11 +38,9 @@ public interface RequestDecorator extends ServicePriority { * @param requestBuilder the request builder to decorate * @param workflowContext the workflow context * @param taskContext the task context - * @param workflowModel the input data */ void decorate( Invocation.Builder requestBuilder, WorkflowContext workflowContext, - TaskContext taskContext, - WorkflowModel workflowModel); + TaskContext taskContext); } From 663dddcd73cb90cdac1556deeacb67a1323e5882 Mon Sep 17 00:00:00 2001 From: Matheus Cruz Date: Mon, 19 Jan 2026 15:20:50 -0300 Subject: [PATCH 2/2] Apply code-style Signed-off-by: Matheus Cruz --- .../impl/events/EmittedEventDecorator.java | 2 +- .../serverlessworkflow/impl/executors/http/HttpExecutor.java | 3 +-- .../impl/executors/http/RequestDecorator.java | 5 +---- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/impl/core/src/main/java/io/serverlessworkflow/impl/events/EmittedEventDecorator.java b/impl/core/src/main/java/io/serverlessworkflow/impl/events/EmittedEventDecorator.java index 7514d549..c73dce1a 100644 --- a/impl/core/src/main/java/io/serverlessworkflow/impl/events/EmittedEventDecorator.java +++ b/impl/core/src/main/java/io/serverlessworkflow/impl/events/EmittedEventDecorator.java @@ -25,7 +25,7 @@ * *

Implementations should be loaded via ServiceLoader and are sorted by priority in ascending * order (lower priority numbers executed first). Decorators are applied in sequence, where later - * decorators can override headers set by earlier decorators with the same header name. + * decorators can override configurations set by earlier decorators. * * @see ServicePriority */ diff --git a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java index 6104160f..7c40d5a9 100644 --- a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java +++ b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java @@ -80,8 +80,7 @@ public CompletableFuture apply( requestDecorator.decorate(request, workflow, taskContext); } - headersMap.ifPresent( - h -> h.apply(workflow, taskContext, input).forEach(request::header)); + headersMap.ifPresent(h -> h.apply(workflow, taskContext, input).forEach(request::header)); return CompletableFuture.supplyAsync( () -> requestFunction.apply(request, uri, workflow, taskContext, input), workflow.definition().application().executorService()); diff --git a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/RequestDecorator.java b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/RequestDecorator.java index 67de21bf..c770e2cf 100644 --- a/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/RequestDecorator.java +++ b/impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/RequestDecorator.java @@ -18,7 +18,6 @@ import io.serverlessworkflow.impl.ServicePriority; import io.serverlessworkflow.impl.TaskContext; import io.serverlessworkflow.impl.WorkflowContext; -import io.serverlessworkflow.impl.WorkflowModel; import jakarta.ws.rs.client.Invocation; /** @@ -40,7 +39,5 @@ public interface RequestDecorator extends ServicePriority { * @param taskContext the task context */ void decorate( - Invocation.Builder requestBuilder, - WorkflowContext workflowContext, - TaskContext taskContext); + Invocation.Builder requestBuilder, WorkflowContext workflowContext, TaskContext taskContext); }