From 9dde0643293fa5c06e845b2a8121486353e8e81c Mon Sep 17 00:00:00 2001 From: Bogumil Zebek Date: Mon, 19 Apr 2021 12:03:25 +0200 Subject: Add healthcheck endpoint Issue-ID: INT-1869 Signed-off-by: Zebek Bogumil Change-Id: Icfc40347deca1dc21233e84732cbd0d7e97b5836 --- .../avcnmanager/kafka/stream/AVCNKafkaStream.java | 61 ---------------------- 1 file changed, 61 deletions(-) delete mode 100644 src/main/java/org/onap/avcnmanager/kafka/stream/AVCNKafkaStream.java (limited to 'src/main/java/org/onap/avcnmanager/kafka/stream/AVCNKafkaStream.java') diff --git a/src/main/java/org/onap/avcnmanager/kafka/stream/AVCNKafkaStream.java b/src/main/java/org/onap/avcnmanager/kafka/stream/AVCNKafkaStream.java deleted file mode 100644 index dfc7912..0000000 --- a/src/main/java/org/onap/avcnmanager/kafka/stream/AVCNKafkaStream.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Simulator - * ================================================================================ - * Copyright (C) 2021 Nokia. All rights reserved. - * ================================================================================ - * Licensed 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.avcnmanager.kafka.stream; - -import org.apache.kafka.streams.KafkaStreams; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; - - -@Component -public class AVCNKafkaStream { - - private static final Logger LOGGER = LoggerFactory.getLogger(AVCNKafkaStream.class); - - private final KafkaStreams streams; - - @Autowired - AVCNKafkaStream(KafkaStreams streams) { - this.streams = streams; - streams.setUncaughtExceptionHandler(this::handleExceptionInStreams); - } - - @PostConstruct - void startKafkaStream() { - streams.start(); - } - - private void handleExceptionInStreams(Thread thread,Throwable throwable) { - LOGGER.warn("Exception occurred int kafka stream: " + thread); - LOGGER.debug(throwable.getMessage()); - if(!streams.state().isRunning()) { - LOGGER.error("Kafka stream stop running, state: " + streams.state()); - streams.close(); - System.exit(1); - } - } -} - - -- cgit 1.2.3-korg