maytasm commented on a change in pull request #11601: URL: https://github.com/apache/druid/pull/11601#discussion_r690348542
########## File path: server/src/main/java/org/apache/druid/server/coordinator/duty/CoordinatorCustomDuty.java ########## @@ -0,0 +1,54 @@ +/* + * 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.druid.server.coordinator.duty; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import org.apache.druid.guice.annotations.ExtensionPoint; +import org.apache.druid.initialization.DruidModule; + +/** + * This {@link ExtensionPoint} allows for coordinator duty to be pluggable + * so that users can register their own duties without modifying Core Druid classes. + * + * Users can write their own custom coordinator duty implemnting this interface and setting the {@link JsonTypeName}. + * Next, users will need to register their custom coordinator as subtypes in their + * Module's {@link DruidModule#getJacksonModules()}. Once these steps are done, user will be able to load their + * custom coordinator duty using the following properties: + * druid.coordinator.dutyGroups=[<GROUP_NAME>] + * druid.coordinator.<GROUP_NAME>.duties=[<DUTY_NAME_MATCHING_JSON_TYPE_NAME>] + * druid.coordinator.<GROUP_NAME>.duty.<DUTY_NAME_MATCHING_JSON_TYPE_NAME>.<SOME_CONFIG_1>=100 + * druid.coordinator.<GROUP_NAME>.duty.<DUTY_NAME_MATCHING_JSON_TYPE_NAME>.<SOME_CONFIG_2>=200 + * druid.coordinator.<GROUP_NAME>.period="P1D" + * + * The duties can be grouped into multiple groups as per the elements in list druid.coordinator.dutyGroups. + * All duties in the same group will have the same run period configured by druid.coordinator.<GROUP_NAME>.period. + * There will be a single thread running the duties sequentially for each group. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "killSupervisors", value = KillSupervisorsCustomDuty.class), +}) +@ExtensionPoint +public interface CoordinatorCustomDuty extends CoordinatorDuty Review comment: Added the explanation. There are two reasons: 1) because existing implementations don't have associated JSON type 2) existing core Druid duties are core to the system and should not be grouped differently / enabled/ disabled by the user (with the exception of the cleanup metadata duties which we may refactor later). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
