This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3623 from charybr/feature/task_status_listener
Feature: Need for Task status listener
- Loading branch information
Showing
7 changed files
with
181 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
core/src/main/java/com/netflix/conductor/core/listener/TaskStatusListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2023 Netflix, Inc. | ||
* <p> | ||
* 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 | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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 com.netflix.conductor.core.listener; | ||
|
||
import com.netflix.conductor.model.TaskModel; | ||
|
||
/** | ||
* Listener for the Task status change. All methods have default implementation so that | ||
* Implementation can choose to override a subset of interested Task statuses. | ||
*/ | ||
public interface TaskStatusListener { | ||
|
||
default void onTaskScheduled(TaskModel task) {} | ||
|
||
default void onTaskInProgress(TaskModel task) {} | ||
|
||
default void onTaskCanceled(TaskModel task) {} | ||
|
||
default void onTaskFailed(TaskModel task) {} | ||
|
||
default void onTaskFailedWithTerminalError(TaskModel task) {} | ||
|
||
default void onTaskCompleted(TaskModel task) {} | ||
|
||
default void onTaskCompletedWithErrors(TaskModel task) {} | ||
|
||
default void onTaskTimedOut(TaskModel task) {} | ||
|
||
default void onTaskSkipped(TaskModel task) {} | ||
} |
69 changes: 69 additions & 0 deletions
69
core/src/main/java/com/netflix/conductor/core/listener/TaskStatusListenerStub.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright 2023 Netflix, Inc. | ||
* <p> | ||
* 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 | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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 com.netflix.conductor.core.listener; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.netflix.conductor.model.TaskModel; | ||
|
||
/** Stub listener default implementation */ | ||
public class TaskStatusListenerStub implements TaskStatusListener { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(TaskStatusListenerStub.class); | ||
|
||
@Override | ||
public void onTaskScheduled(TaskModel task) { | ||
LOGGER.debug("Task {} is scheduled", task.getTaskId()); | ||
} | ||
|
||
@Override | ||
public void onTaskCanceled(TaskModel task) { | ||
LOGGER.debug("Task {} is canceled", task.getTaskId()); | ||
} | ||
|
||
@Override | ||
public void onTaskCompleted(TaskModel task) { | ||
LOGGER.debug("Task {} is completed", task.getTaskId()); | ||
} | ||
|
||
@Override | ||
public void onTaskCompletedWithErrors(TaskModel task) { | ||
LOGGER.debug("Task {} is completed with errors", task.getTaskId()); | ||
} | ||
|
||
@Override | ||
public void onTaskFailed(TaskModel task) { | ||
LOGGER.debug("Task {} is failed", task.getTaskId()); | ||
} | ||
|
||
@Override | ||
public void onTaskFailedWithTerminalError(TaskModel task) { | ||
LOGGER.debug("Task {} is failed with terminal error", task.getTaskId()); | ||
} | ||
|
||
@Override | ||
public void onTaskInProgress(TaskModel task) { | ||
LOGGER.debug("Task {} is in-progress", task.getTaskId()); | ||
} | ||
|
||
@Override | ||
public void onTaskSkipped(TaskModel task) { | ||
LOGGER.debug("Task {} is skipped", task.getTaskId()); | ||
} | ||
|
||
@Override | ||
public void onTaskTimedOut(TaskModel task) { | ||
LOGGER.debug("Task {} is timed out", task.getTaskId()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters