Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
import io.serverlessworkflow.impl.TaskContext;
import io.serverlessworkflow.impl.WorkflowContext;

/**
* Interface for decorating {@link CloudEventBuilder} objects.
*
* <p>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 configurations set by earlier decorators.
*
* @see ServicePriority
*/
public interface EmittedEventDecorator extends ServicePriority {

void decorate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ public CompletableFuture<WorkflowModel> 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)));
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -38,11 +37,7 @@ 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);
Invocation.Builder requestBuilder, WorkflowContext workflowContext, TaskContext taskContext);
}