Skip to content

Commit 194fb1d

Browse files
authored
[NO-ISSUE] Minor adjustments to decorators (#1104)
* Apply minor adjustments to decorators Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com> * Apply code-style Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com> --------- Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
1 parent 0e8add5 commit 194fb1d

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

impl/core/src/main/java/io/serverlessworkflow/impl/events/EmittedEventDecorator.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
import io.serverlessworkflow.impl.TaskContext;
2121
import io.serverlessworkflow.impl.WorkflowContext;
2222

23+
/**
24+
* Interface for decorating {@link CloudEventBuilder} objects.
25+
*
26+
* <p>Implementations should be loaded via ServiceLoader and are sorted by priority in ascending
27+
* order (lower priority numbers executed first). Decorators are applied in sequence, where later
28+
* decorators can override configurations set by earlier decorators.
29+
*
30+
* @see ServicePriority
31+
*/
2332
public interface EmittedEventDecorator extends ServicePriority {
2433

2534
void decorate(

impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/HttpExecutor.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,10 @@ public CompletableFuture<WorkflowModel> apply(
7777
Builder request = target.request();
7878

7979
for (RequestDecorator requestDecorator : requestDecorators) {
80-
requestDecorator.decorate(request, workflow, taskContext, input);
80+
requestDecorator.decorate(request, workflow, taskContext);
8181
}
8282

83-
headersMap.ifPresent(
84-
h -> h.apply(workflow, taskContext, input).forEach((k, v) -> request.header(k, v)));
83+
headersMap.ifPresent(h -> h.apply(workflow, taskContext, input).forEach(request::header));
8584
return CompletableFuture.supplyAsync(
8685
() -> requestFunction.apply(request, uri, workflow, taskContext, input),
8786
workflow.definition().application().executorService());

impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/RequestDecorator.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import io.serverlessworkflow.impl.ServicePriority;
1919
import io.serverlessworkflow.impl.TaskContext;
2020
import io.serverlessworkflow.impl.WorkflowContext;
21-
import io.serverlessworkflow.impl.WorkflowModel;
2221
import jakarta.ws.rs.client.Invocation;
2322

2423
/**
@@ -38,11 +37,7 @@ public interface RequestDecorator extends ServicePriority {
3837
* @param requestBuilder the request builder to decorate
3938
* @param workflowContext the workflow context
4039
* @param taskContext the task context
41-
* @param workflowModel the input data
4240
*/
4341
void decorate(
44-
Invocation.Builder requestBuilder,
45-
WorkflowContext workflowContext,
46-
TaskContext taskContext,
47-
WorkflowModel workflowModel);
42+
Invocation.Builder requestBuilder, WorkflowContext workflowContext, TaskContext taskContext);
4843
}

0 commit comments

Comments
 (0)