blob: 6ae05b8ddad616423e73069e42b2ddf86b4c48c9 [file] [log] [blame]
William Kurkianbde6fc92018-07-13 17:19:58 -04001/*
2 * 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 */
16package 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");
43 KafkaThread kafka = new KafkaThread();
44 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() {
54 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 }
61
62 }
63 }