blob: d7a0d0e6fd2e10e27e6b815556b8d17ad1bdbba0 [file] [log] [blame]
William Kurkianbde6fc92018-07-13 17:19:58 -04001/*
William Kurkian1bedb412018-07-19 12:55:41 -04002* Copyright 2018- Cisco
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*/
William Kurkianbde6fc92018-07-13 17:19:58 -040016package controller;
17
18import org.springframework.boot.SpringApplication;
19import org.springframework.boot.autoconfigure.SpringBootApplication;
20import org.springframework.web.bind.annotation.RequestMapping;
21import org.springframework.web.bind.annotation.RestController;
22import kafka.VolthaKafkaConsumer;
23
24import org.slf4j.Logger;
25import org.slf4j.LoggerFactory;
26
27import java.lang.InterruptedException;
28
29import config.Config;
30
31
32@SpringBootApplication
33@RestController
34public class Application {
35
36 @RequestMapping("/")
37 public String home() {
38 return "Hello Docker World";
39 }
40
41 public static void main(String[] args) {
42 Config.loadProperties("/opt/ves-agent/config.properties");
William Kurkian1bedb412018-07-19 12:55:41 -040043 KafkaThread kafka = new KafkaThread();
William Kurkianbde6fc92018-07-13 17:19:58 -040044 kafka.start();
45 SpringApplication.run(Application.class, args);
46 }
47
48}
49class KafkaThread extends Thread {
50
51 private final static Logger logger = LoggerFactory.getLogger("KafkaThread");
52
53 public void run() {
William Kurkian1bedb412018-07-19 12:55:41 -040054 logger.debug("Start Kafka Consumer Thread");
55 try {
56 VolthaKafkaConsumer consumer = new VolthaKafkaConsumer();
57 consumer.runConsumer();
58 } catch (InterruptedException e) {
59 logger.error(e.getMessage());
60 }
William Kurkianbde6fc92018-07-13 17:19:58 -040061
62 }
William Kurkian1bedb412018-07-19 12:55:41 -040063}