kafka TaskStatus 源码

  • 2022-10-20
  • 浏览 (223)

kafka TaskStatus 代码

文件路径:/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/TaskStatus.java

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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 org.apache.kafka.connect.runtime;

import org.apache.kafka.connect.util.ConnectorTaskId;

public class TaskStatus extends AbstractStatus<ConnectorTaskId> {

    public TaskStatus(ConnectorTaskId id, State state, String workerUrl, int generation, String trace) {
        super(id, state, workerUrl, generation, trace);
    }

    public TaskStatus(ConnectorTaskId id, State state, String workerUrl, int generation) {
        super(id, state, workerUrl, generation, null);
    }

    public interface Listener {

        /**
         * Invoked after successful startup of the task.
         * @param id The id of the task
         */
        void onStartup(ConnectorTaskId id);

        /**
         * Invoked after the task has been paused.
         * @param id The id of the task
         */
        void onPause(ConnectorTaskId id);

        /**
         * Invoked after the task has been resumed.
         * @param id The id of the task
         */
        void onResume(ConnectorTaskId id);

        /**
         * Invoked if the task raises an error. No shutdown event will follow.
         * @param id The id of the task
         * @param cause The error raised by the task.
         */
        void onFailure(ConnectorTaskId id, Throwable cause);

        /**
         * Invoked after successful shutdown of the task.
         * @param id The id of the task
         */
        void onShutdown(ConnectorTaskId id);

        /**
         * Invoked after the task has been deleted. Can be called if the
         * connector tasks have been reduced, or if the connector itself has
         * been deleted.
         * @param id The id of the task
         */
        void onDeletion(ConnectorTaskId id);

        /**
         * Invoked when the task is restarted asynchronously by the herder on processing a restart request.
         * @param id The id of the task
         */
        void onRestart(ConnectorTaskId id);
    }
}

相关信息

kafka 源码目录

相关文章

kafka AbstractHerder 源码

kafka AbstractStatus 源码

kafka AbstractWorkerSourceTask 源码

kafka CloseableConnectorContext 源码

kafka Connect 源码

kafka ConnectMetrics 源码

kafka ConnectMetricsRegistry 源码

kafka ConnectorConfig 源码

kafka ConnectorStatus 源码

kafka ExactlyOnceWorkerSourceTask 源码

0  赞