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 @@ -424,18 +424,6 @@ public <V> Task<V> callActivity(
scheduleTaskBuilder.setInput(StringValue.of(serializedInput));
}

// Add router information for cross-app routing
if (hasSourceAppId() && hasTargetAppId(options)) {
String targetAppId = options.getAppID();
scheduleTaskBuilder.setRouter(Orchestration.TaskRouter.newBuilder()
.setSourceAppID(this.appId)
.setTargetAppID(targetAppId)
.build());
this.logger.fine(() -> String.format(
"cross app routing detected: source=%s, target=%s",
this.appId, targetAppId));
}

// Set history propagation scope if specified
if (options != null && options.hasHistoryPropagationScope()) {
scheduleTaskBuilder.setHistoryPropagationScope(
Expand All @@ -449,10 +437,14 @@ public <V> Task<V> callActivity(
.setId(id)
.setScheduleTask(scheduleTaskBuilder);
if (hasSourceAppId() && hasTargetAppId(options)) {
String targetAppId = options.getAppID();
actionBuilder.setRouter(Orchestration.TaskRouter.newBuilder()
.setSourceAppID(this.appId)
.setTargetAppID(options.getAppID())
.setTargetAppID(targetAppId)
.build());
this.logger.fine(() -> String.format(
"cross app routing detected: source=%s, target=%s",
this.appId, targetAppId));
}
this.pendingActions.put(id, actionBuilder.build());

Expand Down Expand Up @@ -597,22 +589,6 @@ public <V> Task<V> callSubOrchestrator(
}
createSubOrchestrationActionBuilder.setInstanceId(instanceId);

// Add router information for cross-app routing of sub-orchestrations
if (hasSourceAppId()) {
Orchestration.TaskRouter.Builder routerBuilder = Orchestration.TaskRouter.newBuilder()
.setSourceAppID(this.appId);

// Add target app ID if specified in options
if (hasTargetAppId(options)) {
routerBuilder.setTargetAppID(options.getAppID());
this.logger.fine(() -> String.format(
"cross app sub-orchestration routing detected: source=%s, target=%s",
this.appId, options.getAppID()));
}

createSubOrchestrationActionBuilder.setRouter(routerBuilder.build());
}

// Set history propagation scope if specified
if (options != null && options.hasHistoryPropagationScope()) {
createSubOrchestrationActionBuilder.setHistoryPropagationScope(
Expand All @@ -632,6 +608,9 @@ public <V> Task<V> callSubOrchestrator(
.setSourceAppID(this.appId);
if (hasTargetAppId(options)) {
actionRouterBuilder.setTargetAppID(options.getAppID());
this.logger.fine(() -> String.format(
"cross app sub-orchestration routing detected: source=%s, target=%s",
this.appId, options.getAppID()));
}
actionBuilder.setRouter(actionRouterBuilder.build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,6 @@ void historyPropagation_combinedWithCrossAppRouting_bothWork() {
OrchestratorActions.CreateChildWorkflowAction createChild = action.getCreateChildWorkflow();

// Verify BOTH cross-app routing and history propagation are set
assertTrue(createChild.hasRouter());
assertEquals(sourceAppId, createChild.getRouter().getSourceAppID());
assertEquals(targetAppId, createChild.getRouter().getTargetAppID());

assertTrue(createChild.hasHistoryPropagationScope());
assertEquals(Orchestration.HistoryPropagationScope.HISTORY_PROPAGATION_SCOPE_LINEAGE,
createChild.getHistoryPropagationScope());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,11 @@ void callSubOrchestrator_withTargetAppId_setsRouterOnAction() {
OrchestratorActions.WorkflowAction action = actions.get(0);
assertTrue(action.hasCreateChildWorkflow());

// Verify the CreateSubOrchestrationAction has the router
OrchestratorActions.CreateChildWorkflowAction createSub = action.getCreateChildWorkflow();
assertEquals(subOrchestratorName, createSub.getName());
assertEquals("child-instance-1", createSub.getInstanceId());
assertTrue(createSub.hasRouter());
assertEquals(sourceAppId, createSub.getRouter().getSourceAppID());
assertTrue(createSub.getRouter().hasTargetAppID());
assertEquals(targetAppId, createSub.getRouter().getTargetAppID());

// Verify the OrchestratorAction also has the router
// Verify the OrchestratorAction has the router
assertTrue(action.hasRouter());
assertEquals(sourceAppId, action.getRouter().getSourceAppID());
assertTrue(action.getRouter().hasTargetAppID());
Expand Down Expand Up @@ -198,13 +193,7 @@ void callSubOrchestrator_withoutTargetAppId_setsRouterWithSourceOnly() {
OrchestratorActions.WorkflowAction action = actions.get(0);
assertTrue(action.hasCreateChildWorkflow());

// Router should have source only, no target
OrchestratorActions.CreateChildWorkflowAction createSub = action.getCreateChildWorkflow();
assertTrue(createSub.hasRouter());
assertEquals(sourceAppId, createSub.getRouter().getSourceAppID());
assertFalse(createSub.getRouter().hasTargetAppID());

// OrchestratorAction router should also have source only
// OrchestratorAction router should have source only, no target
assertTrue(action.hasRouter());
assertEquals(sourceAppId, action.getRouter().getSourceAppID());
assertFalse(action.getRouter().hasTargetAppID());
Expand Down Expand Up @@ -239,8 +228,6 @@ void callSubOrchestrator_withNullAppId_noRouterSet() {
assertTrue(action.hasCreateChildWorkflow());

// No router should be set when appId is null
OrchestratorActions.CreateChildWorkflowAction createSub = action.getCreateChildWorkflow();
assertFalse(createSub.hasRouter());
assertFalse(action.hasRouter());
}

Expand Down Expand Up @@ -489,11 +476,6 @@ void crossAppSubOrchestration_fullFlow_routersCorrectlySet() {
assertEquals(subOrchestratorName, createSub.getName());
assertEquals("child-id-1", createSub.getInstanceId());

// Verify cross-app router on the sub-orchestration action
assertTrue(createSub.hasRouter());
assertEquals(sourceAppId, createSub.getRouter().getSourceAppID());
assertEquals(targetAppId, createSub.getRouter().getTargetAppID());

// Verify cross-app router on the OrchestratorAction envelope
assertTrue(subAction.hasRouter());
assertEquals(sourceAppId, subAction.getRouter().getSourceAppID());
Expand Down Expand Up @@ -527,7 +509,6 @@ void callSubOrchestrator_withEmptyAppId_noRouterSet() {
assertTrue(action.hasCreateChildWorkflow());

// No router should be set when appId is empty
assertFalse(action.getCreateChildWorkflow().hasRouter());
assertFalse(action.hasRouter());
}

Expand Down Expand Up @@ -569,9 +550,8 @@ void callSubOrchestrator_withRetryPolicyAndAppId_setsRouterAndRetries() {
OrchestratorActions.WorkflowAction action = actions.get(0);
assertTrue(action.hasCreateChildWorkflow());

OrchestratorActions.CreateChildWorkflowAction createSub = action.getCreateChildWorkflow();
assertTrue(createSub.hasRouter());
assertEquals(sourceAppId, createSub.getRouter().getSourceAppID());
assertEquals(targetAppId, createSub.getRouter().getTargetAppID());
assertTrue(action.hasRouter());
assertEquals(sourceAppId, action.getRouter().getSourceAppID());
assertEquals(targetAppId, action.getRouter().getTargetAppID());
}
}
Loading