feat: Add configurable workflow status subscription for HTTP webhook publisher#720
Conversation
df6b305 to
4c32dc2
Compare
|
Yes we are on it and should be part of next release if all looks good. |
manan164
left a comment
There was a problem hiding this comment.
Backward Compatibility Issue
Problem: This PR introduces a breaking change for existing deployments.
Current Behavior (Before This PR)
@Override
public void onWorkflowCompleted(WorkflowModel workflow) {
blockingQueue.put(workflow); // ALWAYS publishes
}COMPLETED and TERMINATED events are always published automatically with no configuration needed.
New Behavior (With This PR)
@Override
public void onWorkflowCompleted(WorkflowModel workflow) {
if (subscribedWorkflowStatusList != null
&& subscribedWorkflowStatusList.contains("COMPLETED")) {
enqueueWorkflow(workflow); // Only publishes if configured
}
// Otherwise: NOTHING happens
}Events are only published if explicitly configured.
Breaking Scenario
Existing User:
- Using HTTP webhook publisher:
conductor.workflow-status-listener.type=workflow_publisher - Receiving COMPLETED and TERMINATED webhooks automatically
- Their monitoring/integration relies on these webhooks
After Upgrading:
- User doesn't set the new property (doesn't know it exists or thinks it's optional)
- Spring injects
subscribedWorkflowStatusList = null - Condition fails:
null != null→ false - NO webhooks are sent anymore ❌
- User's monitoring breaks
Recommended Fix
Default to previous behavior when not configured:
public StatusChangePublisher(
RestClientManager rcm,
ExecutionDAOFacade executionDAOFacade,
List<String> subscribedWorkflowStatuses) {
this.rcm = rcm;
this.executionDAOFacade = executionDAOFacade;
// Preserve backward compatibility - default to COMPLETED and TERMINATED
this.subscribedWorkflowStatusList = (subscribedWorkflowStatuses != null && !subscribedWorkflowStatuses.isEmpty())
? subscribedWorkflowStatuses
: Arrays.asList("COMPLETED", "TERMINATED");
ConsumerThread consumerThread = new ConsumerThread();
consumerThread.start();
}This way:
- ✅ No config = keeps working (COMPLETED + TERMINATED)
- ✅ Empty list = opt-out (disable all)
- ✅ Custom config = opt-in to specific statuses
Also update the test testWithNullSubscribedList() to verify it publishes COMPLETED and TERMINATED by default.
Note: CI is failing on an unrelated flaky test (PostgresGrpcEndToEndTest). Suggest rebasing on main after PR #772 merges, which fixes the Docker Engine 29.1 incompatibility.
9bd0c1b to
2041eaf
Compare
|
Hi @manan164 Thanks for the catch! Rebased with main and fixed -- null/empty list now defaults to ["COMPLETED", "TERMINATED"] to preserve backward compatibility. Also, I noticed your comment mentions Open to your thoughts on this! |
2041eaf to
82aa414
Compare
Resolves #710
Summary
Enables configuration-based control over which workflow status changes trigger HTTP webhook events, matching the existing task status publishing behavior.
Problem
The HTTP webhook publisher (
conductor.workflow-status-listener.type=workflow_publisher) currently hardcodes publishing only COMPLETED and TERMINATED workflow events, with no way to configure which statuses to receive. This is inconsistent with the task publisher which allows full configurability via subscribed-task-statuses.Solution
Added subscribedWorkflowStatuses configuration property to enable selective workflow event publishing:
Changes
subscribedWorkflowStatusesfield with getters/settersTesting
✅ All 9 workflow status methods tested with various configurations
✅ Null and empty list handling
✅ Build successful with no linter errors