Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand All @@ -108,7 +108,6 @@
<version>1.0</version>
<scope>compile</scope>
</dependency>

</dependencies>

<build>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/uci/inbound/cdac/CDACConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.uci.inbound.utils.XMsgProcessingUtil;
import com.uci.dao.repository.XMessageRepository;
import com.uci.utils.kafka.SimpleProducer;
import com.uci.utils.kafka.RecordProducer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
Expand Down Expand Up @@ -38,7 +40,7 @@ public class CDACConverter {
private CdacBulkSmsAdapter cdacBulkSmsAdapter;

@Autowired
public SimpleProducer kafkaProducer;
public RecordProducer kafkaProducer;

@Autowired
public XMessageRepository xmsgRepo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import com.uci.dao.repository.XMessageRepository;
import com.uci.utils.BotService;
import com.uci.utils.kafka.SimpleProducer;
import com.uci.utils.kafka.RecordProducer;

import io.opentelemetry.api.trace.Tracer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -35,13 +38,16 @@ public class DikshaWebController {
private SunbirdWebPortalAdapter sunbirdWebPortalAdapter;

@Autowired
public SimpleProducer kafkaProducer;
public RecordProducer kafkaProducer;

@Autowired
public XMessageRepository xmsgRepo;

@Autowired
public BotService botService;

@Autowired
public Tracer tracer;

@RequestMapping(value = "/web", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void dikshaWeb(@RequestBody SunbirdWebMessage message) throws JsonProcessingException, JAXBException {
Expand All @@ -59,6 +65,7 @@ public void dikshaWeb(@RequestBody SunbirdWebMessage message) throws JsonProcess
.topicSuccess(inboundProcessed)
.kafkaProducer(kafkaProducer)
.botService(botService)
.tracer(tracer)
.build()
.process();
}
Expand Down
38 changes: 38 additions & 0 deletions src/main/java/com/uci/inbound/health/HealthController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.uci.dao.service.HealthService;

import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.Tracer;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.Scope;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
Expand Down Expand Up @@ -41,4 +45,38 @@ public ResponseEntity<JsonNode> statusCheck() throws JsonProcessingException, IO

return ResponseEntity.ok(jsonNode);
}

// @Autowired
// private Tracer tracer;

@RequestMapping(value = "/test-lightstep", method = RequestMethod.GET, produces = { "application/json", "text/json" })
public ResponseEntity<JsonNode> test() throws JsonProcessingException, IOException {

// log.error("Health API called");
//
// Span span = tracer.spanBuilder("main-inbound-kafka").startSpan();
//
// int data;
// try (Scope scope = span.makeCurrent()) {
// Span childSpan = tracer.spanBuilder("child-inbound-kafka")
// .setParent(Context.current().with(span))
// .startSpan();
//
ObjectMapper mapper = new ObjectMapper();

JsonNode jsonNode = mapper.readTree("{\"id\":\"api.content.health\",\"ver\":\"3.0\",\"ts\":\"2021-06-26T22:47:05Z+05:30\",\"params\":{\"resmsgid\":\"859fee0c-94d6-4a0d-b786-2025d763b78a\",\"msgid\":null,\"err\":null,\"status\":\"successful\",\"errmsg\":null},\"responseCode\":\"OK\",\"result\":{\"checks\":[{\"name\":\"redis cache\",\"healthy\":true},{\"name\":\"graph db\",\"healthy\":true},{\"name\":\"cassandra db\",\"healthy\":true}],\"healthy\":true}}");

int i = 0;
while(i <= 1000) {
log.info("Value of i: "+i);
i++;
}

return ResponseEntity.ok(jsonNode);
// } finally {
// span.end();
// }


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import com.uci.utils.BotService;
import com.uci.inbound.utils.XMsgProcessingUtil;
import com.uci.utils.kafka.SimpleProducer;
import com.uci.utils.kafka.RecordProducer;

import io.opentelemetry.api.trace.Tracer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
Expand Down Expand Up @@ -37,13 +41,16 @@ public class GupShupWhatsappConverter {
private GupShupWhatsappAdapter gupShupWhatsappAdapter;

@Autowired
public SimpleProducer kafkaProducer;
public RecordProducer kafkaProducer;

@Autowired
public XMessageRepository xmsgRepository;

@Autowired
public BotService botService;

@Autowired
public Tracer tracer;

@RequestMapping(value = "/whatsApp", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public void gupshupWhatsApp(@Valid GSWhatsAppMessage message) throws JsonProcessingException, JAXBException {
Expand All @@ -61,6 +68,7 @@ public void gupshupWhatsApp(@Valid GSWhatsAppMessage message) throws JsonProcess
.topicSuccess(inboundProcessed)
.kafkaProducer(kafkaProducer)
.botService(botService)
.tracer(tracer)
.build()
.process();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import com.uci.inbound.utils.XMsgProcessingUtil;
import com.uci.dao.repository.XMessageRepository;
import com.uci.utils.kafka.SimpleProducer;
import com.uci.utils.kafka.RecordProducer;

import io.opentelemetry.api.trace.Tracer;
import lombok.extern.slf4j.Slf4j;
import com.uci.utils.BotService;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -35,20 +38,20 @@ public class NetcoreWhatsappConverter {
private NetcoreWhatsappAdapter netcoreWhatsappAdapter;

@Autowired
public SimpleProducer kafkaProducer;
public RecordProducer kafkaProducer;

@Autowired
public XMessageRepository xmsgRepo;

@Autowired
public BotService botService;

@Autowired
public Tracer tracer;

@RequestMapping(value = "/whatsApp", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public void netcoreWhatsApp(@RequestBody NetcoreMessageFormat message) throws JsonProcessingException, JAXBException {

System.out.println(message.toString());

netcoreWhatsappAdapter = NetcoreWhatsappAdapter.builder()
netcoreWhatsappAdapter = NetcoreWhatsappAdapter.builder()
.botservice(botService)
.build();

Expand All @@ -60,6 +63,7 @@ public void netcoreWhatsApp(@RequestBody NetcoreMessageFormat message) throws Js
.topicSuccess(inboundProcessed)
.kafkaProducer(kafkaProducer)
.botService(botService)
.tracer(tracer)
.build()
.process();
}
Expand Down
Loading