VGalaxies commented on code in PR #12138: URL: https://github.com/apache/iotdb/pull/12138#discussion_r1533244419
########## iotdb-core/datanode/src/main/java/org/apache/iotdb/db/subscription/agent/SubscriptionRuntimeAgent.java: ########## @@ -0,0 +1,98 @@ +/* + * 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.iotdb.db.subscription.agent; + +import org.apache.iotdb.commons.exception.StartupException; +import org.apache.iotdb.commons.service.IService; +import org.apache.iotdb.commons.service.ServiceType; +import org.apache.iotdb.commons.subscription.config.SubscriptionConfig; +import org.apache.iotdb.db.pipe.agent.PipeAgent; + +import java.util.concurrent.atomic.AtomicBoolean; + +public class SubscriptionRuntimeAgent implements IService { + + private final SubscriptionConsumerAgent consumerAgent; + + private final SubscriptionBrokerAgent brokerAgent; + + private final SubscriptionTopicAgent topicAgent; + + private final AtomicBoolean isShutdown = new AtomicBoolean(false); + + SubscriptionRuntimeAgent() { + // make it package-private + consumerAgent = new SubscriptionConsumerAgent(); + brokerAgent = new SubscriptionBrokerAgent(); + topicAgent = new SubscriptionTopicAgent(); + } + + SubscriptionConsumerAgent consumer() { + // make it package-private + return consumerAgent; + } + + SubscriptionBrokerAgent broker() { + // make it package-private + return brokerAgent; + } + + SubscriptionTopicAgent topic() { + // make it package-private + return topicAgent; + } + + //////////////////////////// System Service Interface //////////////////////////// + + @Override + public void start() throws StartupException { + SubscriptionConfig.getInstance().printAllConfigs(); + + SubscriptionAgentLauncher.launchSubscriptionTopicAgent(); + SubscriptionAgentLauncher.launchSubscriptionConsumerAgent(); + + PipeAgent.runtime() + .registerPeriodicalJob( + "SubscriptionBrokerAgent::recycleUncommittedEvents()", + brokerAgent::recycleUncommittedEvents, + 1); Review Comment: TODO: config -- 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]
