org.apache.kafka.connect.runtime.WorkerTask Maven / Gradle / Ivy
/**
* 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 java.util.Map;
/**
* Handles processing for an individual task. This interface only provides the basic methods
* used by {@link Worker} to manage the tasks. Implementations combine a user-specified Task with
* Kafka to create a data flow.
*/
interface WorkerTask {
/**
* Start the Task
* @param props initial configuration
*/
void start(Map props);
/**
* Stop this task from processing messages. This method does not block, it only triggers
* shutdown. Use #{@link #awaitStop} to block until completion.
*/
void stop();
/**
* Wait for this task to finish stopping.
*
* @param timeoutMs
* @return true if successful, false if the timeout was reached
*/
boolean awaitStop(long timeoutMs);
/**
* Close this task. This is different from #{@link #stop} and #{@link #awaitStop} in that the
* stop methods ensure processing has stopped but may leave resources allocated. This method
* should clean up all resources.
*/
void close();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy