umustafi commented on code in PR #3557: URL: https://github.com/apache/gobblin/pull/3557#discussion_r978022183
########## gobblin-service/src/main/java/org/apache/gobblin/service/monitoring/SpecStoreChangeMonitorFactory.java: ########## @@ -0,0 +1,61 @@ +/* + * 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.gobblin.service.monitoring; + +import java.util.Objects; + +import com.typesafe.config.Config; + +import javax.inject.Inject; +import javax.inject.Provider; +import lombok.extern.slf4j.Slf4j; + +import org.apache.gobblin.util.ConfigUtils; +import org.apache.gobblin.util.reflection.GobblinConstructorUtils; + + +/** + * A factory implementation that returns a {@link SpecStoreChangeMonitor} instance. + */ +@Slf4j +public class SpecStoreChangeMonitorFactory implements Provider<SpecStoreChangeMonitor> { + private final Config config; + + @Inject + public SpecStoreChangeMonitorFactory(Config config) { + this.config = Objects.requireNonNull(config); + } + + private SpecStoreChangeMonitor createSpecStoreChangeMonitor() + throws ReflectiveOperationException { + Config specStoreChangeConfig = config.getConfig(SpecStoreChangeMonitor.SPEC_STORE_CHANGE_MONITOR_PREFIX); + String topic = specStoreChangeConfig.getString(SpecStoreChangeMonitor.SPEC_STORE_CHANGE_MONITOR_TOPIC_KEY); + int numThreads = ConfigUtils.getInt(specStoreChangeConfig, SpecStoreChangeMonitor.SPEC_STORE_CHANGE_MONITOR_NUM_THREADS_KEY, 5); Review Comment: I'm moving the topic and num threads key to this class. We need the prefix to extract the config with all the spec store change monitor prefixed values `Config specStoreChangeConfig = config.getConfig(SpecStoreChangeMonitor.SPEC_STORE_CHANGE_MONITOR_PREFIX);` -- 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]
