Skip to content
Open
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
@@ -0,0 +1,115 @@
/*
* Copyright 2026 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/

package io.dapr.durabletask;

import com.google.protobuf.StringValue;
import io.dapr.durabletask.implementation.protobuf.Orchestration.TaskFailureDetails;

/**
* Holds the status and data of a named activity invocation observed in
* propagated workflow history. An activity is reported as {@code started}
* once it was scheduled; {@code completed} or {@code failed} reflect the
* terminal state of that scheduling.
*/
public final class ActivityResult {
private final String name;
private final boolean started;
private final boolean completed;
private final boolean failed;
private final StringValue input;
private final StringValue output;
private final TaskFailureDetails error;

ActivityResult(String name,
boolean started,
boolean completed,
boolean failed,
StringValue input,
StringValue output,
TaskFailureDetails error) {
this.name = name;
this.started = started;
this.completed = completed;
this.failed = failed;
this.input = input;
this.output = output;
this.error = error;
}

/**
* Gets the activity name.
*
* @return the activity name
*/
public String getName() {
return this.name;
}

/**
* Returns true if the activity was scheduled.
*
* @return whether the activity started
*/
public boolean isStarted() {
return this.started;
}

/**
* Returns true if the activity completed successfully.
*
* @return whether the activity completed
*/
public boolean isCompleted() {
return this.completed;
}

/**
* Returns true if the activity failed.
*
* @return whether the activity failed
*/
public boolean isFailed() {
return this.failed;
}

/**
* Gets the activity input as recorded in the scheduling event, or null if
* no input was provided.
*
* @return the input wrapper, or null
*/
public StringValue getInput() {
return this.input;
}

/**
* Gets the activity output from the matching completion event, or null if
* the activity has not completed successfully.
*
* @return the output wrapper, or null
*/
public StringValue getOutput() {
return this.output;
}

/**
* Gets the failure details from the matching failure event, or null if the
* activity has not failed.
*
* @return the failure details, or null
*/
public TaskFailureDetails getError() {
return this.error;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* Copyright 2026 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/

package io.dapr.durabletask;

import com.google.protobuf.StringValue;
import io.dapr.durabletask.implementation.protobuf.Orchestration.TaskFailureDetails;

/**
* Holds the status and data of a named child workflow invocation observed in
* propagated workflow history.
*/
public final class ChildWorkflowResult {
private final String name;
private final boolean started;
private final boolean completed;
private final boolean failed;
private final StringValue output;
private final TaskFailureDetails error;

ChildWorkflowResult(String name,
boolean started,
boolean completed,
boolean failed,
StringValue output,
TaskFailureDetails error) {
this.name = name;
this.started = started;
this.completed = completed;
this.failed = failed;
this.output = output;
this.error = error;
}

/**
* Gets the child workflow name.
*
* @return the child workflow name
*/
public String getName() {
return this.name;
}

/**
* Returns true if the child workflow was scheduled.
*
* @return whether the child workflow started
*/
public boolean isStarted() {
return this.started;
}

/**
* Returns true if the child workflow completed successfully.
*
* @return whether the child workflow completed
*/
public boolean isCompleted() {
return this.completed;
}

/**
* Returns true if the child workflow failed.
*
* @return whether the child workflow failed
*/
public boolean isFailed() {
return this.failed;
}

/**
* Gets the child workflow output from the matching completion event, or
* null if the child workflow has not completed successfully.
*
* @return the output wrapper, or null
*/
public StringValue getOutput() {
return this.output;
}

/**
* Gets the failure details from the matching failure event, or null if the
* child workflow has not failed.
*
* @return the failure details, or null
*/
public TaskFailureDetails getError() {
return this.error;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright 2026 The Dapr Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
limitations under the License.
*/

package io.dapr.durabletask;

import io.dapr.durabletask.implementation.protobuf.Orchestration;

/**
* Controls how execution history is propagated to a child workflow or activity.
*/
public enum HistoryPropagationScope {
/**
* No propagation. The child receives no history from the caller.
*/
NONE,

/**
* Propagate the caller's own history events only. The child does not see
* any ancestral history (trust boundary).
*/
OWN_HISTORY,

/**
* Propagate the caller's own history events AND the full ancestral chain.
* Any propagated history this workflow received from its parent is forwarded to the child.
*/
LINEAGE;

Orchestration.HistoryPropagationScope toProto() {
switch (this) {
case OWN_HISTORY:
return Orchestration.HistoryPropagationScope.HISTORY_PROPAGATION_SCOPE_OWN_HISTORY;
case LINEAGE:
return Orchestration.HistoryPropagationScope.HISTORY_PROPAGATION_SCOPE_LINEAGE;
default:
return Orchestration.HistoryPropagationScope.HISTORY_PROPAGATION_SCOPE_NONE;
}
}

static HistoryPropagationScope fromProto(Orchestration.HistoryPropagationScope proto) {
switch (proto) {
case HISTORY_PROPAGATION_SCOPE_OWN_HISTORY:
return OWN_HISTORY;
case HISTORY_PROPAGATION_SCOPE_LINEAGE:
return LINEAGE;
default:
return NONE;
}
}
}
Loading
Loading