Skip to content

Commit

Permalink
merge main into branch
Browse files Browse the repository at this point in the history
  • Loading branch information
AHabes committed Oct 27, 2023
2 parents 4d22d00 + 352339e commit d488242
Show file tree
Hide file tree
Showing 42 changed files with 177 additions and 103 deletions.
49 changes: 33 additions & 16 deletions service/application/pom.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.solace.maas</groupId>
<artifactId>maas-event-management-agent-parent</artifactId>
<version>1.1.2-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<groupId>com.solace.maas</groupId>
<artifactId>event-management-agent</artifactId>
<version>1.1.2-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Solace Event Management Agent - Application</name>
<description>Solace Event Management Agent - Application</description>
<properties>
<springdoc.version>1.6.11</springdoc.version>
<snakeyaml.version>2.0</snakeyaml.version>
<spring-cloud-starter-sleuth.version>3.1.5</spring-cloud-starter-sleuth.version>
<spring-security-rsa.version>1.1.1</spring-security-rsa.version>
<spring-kafka.version>3.0.10</spring-kafka.version>
<kafka-clients.version>3.5.0</kafka-clients.version>
Expand All @@ -43,7 +41,7 @@
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>10.1.13</version>
<version>10.1.14</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -63,11 +61,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
<version>${spring-cloud-starter-sleuth.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-rsa</artifactId>
Expand Down Expand Up @@ -260,27 +253,51 @@
<dependency>
<groupId>com.solace.maas</groupId>
<artifactId>plugin</artifactId>
<version>1.1.2-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.solace.maas.plugin.kafka</groupId>
<artifactId>kafka-plugin</artifactId>
<version>1.1.2-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.solace.maas.plugin.solace</groupId>
<artifactId>solace-plugin</artifactId>
<version>1.1.2-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.solace.maas.plugin.localstorage</groupId>
<artifactId>local-storage-plugin</artifactId>
<version>1.1.2-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.solace.maas.plugin.confluent-schema-registry</groupId>
<artifactId>confluent-schema-registry-plugin</artifactId>
<version>1.1.2-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
<!--version>1.1.1</version-->
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>context-propagation</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<!-- for testing -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public class ScanDataImportMessage extends MOPMessage {

String scanId;

String traceId;

String messagingServiceId;

String runtimeAgentId;
Expand All @@ -37,10 +35,10 @@ public ScanDataImportMessage(String orgId, String scanId, String traceId, String

this.orgId = orgId;
this.scanId = scanId;
this.traceId = traceId;
this.messagingServiceId = messagingServiceId;
this.runtimeAgentId = runtimeAgentId;
this.scanTypes = scanTypes;
setTraceId(traceId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ public class ScanDataMessage extends MOPMessage {

String scanId;

String traceId;

String scanType;

String data;

private String timestamp;

public ScanDataMessage(String orgId, String scanId, String traceId, String scanType, String data, String timestamp) {
public ScanDataMessage(String orgId, String scanId, String traceId, String actorId, String scanType, String data, String timestamp) {
super();
withMessageType(MOPMessageType.generic)
.withProtocol(MOPProtocol.scanData)
Expand All @@ -29,10 +27,11 @@ public ScanDataMessage(String orgId, String scanId, String traceId, String scanT

this.orgId = orgId;
this.scanId = scanId;
this.traceId = traceId;
this.scanType = scanType;
this.data = data;
this.timestamp = timestamp;
setTraceId(traceId);
setActorId(actorId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ public class ScanDataStatusMessage extends MOPMessage {

String scanId;

String traceId;

String status;

String description;

String scanType;

public ScanDataStatusMessage(String orgId, String scanId, String traceId, String status, String description, String scanType) {
public ScanDataStatusMessage(String orgId, String scanId, String traceId, String actorId, String status, String description, String scanType) {
super();
withMessageType(MOPMessageType.generic)
.withProtocol(MOPProtocol.scanDataControl)
Expand All @@ -33,10 +31,11 @@ public ScanDataStatusMessage(String orgId, String scanId, String traceId, String

this.orgId = orgId;
this.scanId = scanId;
this.traceId = traceId;
this.status = status;
this.description = description;
this.scanType = scanType;
setTraceId(traceId);
setActorId(actorId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ public class ScanLogMessage extends MOPMessage {

String scanId;

String traceId;

String level;

String log;

Long timestamp;

public ScanLogMessage(String orgId, String scanId, String traceId, String level, String log, Long timestamp) {
public ScanLogMessage(String orgId, String scanId, String traceId, String actorId, String level, String log, Long timestamp) {
super();
withMessageType(MOPMessageType.generic)
.withProtocol(MOPProtocol.scanDataControl)
Expand All @@ -29,10 +27,11 @@ public ScanLogMessage(String orgId, String scanId, String traceId, String level,

this.orgId = orgId;
this.scanId = scanId;
this.traceId = traceId;
this.level = level;
this.log = log;
this.timestamp = timestamp;
setTraceId(traceId);
setActorId(actorId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ public class ScanStatusMessage extends MOPMessage {

String scanId;

String traceId;

String status;

String description;

private List<String> scanTypes;

public ScanStatusMessage(String orgId, String scanId, String traceId, String status, String description, List<String> scanTypes) {
public ScanStatusMessage(String orgId, String scanId, String traceId, String actorId, String status, String description, List<String> scanTypes) {
super();
withMessageType(MOPMessageType.generic)
.withProtocol(MOPProtocol.scanDataControl)
Expand All @@ -35,10 +33,11 @@ public ScanStatusMessage(String orgId, String scanId, String traceId, String sta

this.orgId = orgId;
this.scanId = scanId;
this.traceId = traceId;
this.status = status;
this.description = description;
this.scanTypes = scanTypes;
setTraceId(traceId);
setActorId(actorId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.AppenderBase;
import com.solace.maas.ep.event.management.agent.repository.model.route.RouteEntity;
import com.solace.maas.ep.event.management.agent.plugin.constants.RouteConstants;
import com.solace.maas.ep.event.management.agent.plugin.manager.loader.PluginLoader;
import com.solace.maas.ep.event.management.agent.plugin.route.RouteBundle;
import com.solace.maas.ep.event.management.agent.plugin.route.handler.base.MessagingServiceRouteDelegate;
import com.solace.maas.ep.event.management.agent.repository.model.route.RouteEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -30,20 +30,23 @@ protected void append(ILoggingEvent event) {
sendLogsAsync(event,
event.getMDCPropertyMap().get(RouteConstants.SCAN_ID),
event.getMDCPropertyMap().get(RouteConstants.TRACE_ID),
event.getMDCPropertyMap().get(RouteConstants.ACTOR_ID),
event.getMDCPropertyMap().get(RouteConstants.SCAN_TYPE),
event.getMDCPropertyMap().get(RouteConstants.SCHEDULE_ID),
event.getMDCPropertyMap().get(RouteConstants.MESSAGING_SERVICE_ID));
}
}
}

public void sendLogsAsync(ILoggingEvent event, String scanId, String traceId, String scanType, String groupId, String messagingServiceId) {
public void sendLogsAsync(ILoggingEvent event, String scanId, String traceId, String actorId,
String scanType, String groupId, String messagingServiceId) {
RouteEntity route = creatLoggingRoute(scanType, messagingServiceId);

producerTemplate.asyncSend(route.getId(), exchange -> {
// Need to set headers to let the Route have access to the Scan ID, Group ID, and Messaging Service ID.
exchange.getIn().setHeader(RouteConstants.SCAN_ID, scanId);
exchange.getIn().setHeader(RouteConstants.TRACE_ID, traceId);
exchange.getIn().setHeader(RouteConstants.ACTOR_ID, actorId);
exchange.getIn().setHeader(RouteConstants.SCAN_TYPE, scanType);
exchange.getIn().setHeader(RouteConstants.SCHEDULE_ID, groupId);
exchange.getIn().setHeader(RouteConstants.MESSAGING_SERVICE_ID, messagingServiceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.slf4j.MDC;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

Expand All @@ -23,6 +24,7 @@ public class ScanDataImportParseMetaInfFileProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
MetaInfFileBO metaInfFileBO = exchange.getIn().getBody(MetaInfFileBO.class);
String traceId = (String) exchange.getProperty(TRACE_ID);
MDC.put(TRACE_ID, traceId);

exchange.getIn().setHeader(RouteConstants.SCAN_ID, metaInfFileBO.getScanId());
exchange.getIn().setHeader(RouteConstants.MESSAGING_SERVICE_ID, metaInfFileBO.getMessagingServiceId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ public void process(Exchange exchange) throws Exception {
String messagingServiceId = (String) properties.get(RouteConstants.MESSAGING_SERVICE_ID);
String scanId = (String) properties.get(RouteConstants.SCAN_ID);
String traceId = (String) properties.get(RouteConstants.TRACE_ID);
String actorId = (String) properties.get(RouteConstants.ACTOR_ID);
String scanType = (String) properties.get(RouteConstants.SCAN_TYPE);
Boolean isImportOp = (Boolean) properties.get(RouteConstants.IS_DATA_IMPORT);

ScanDataMessage scanDataMessage = new ScanDataMessage(orgId, scanId, traceId, scanType, body, Instant.now().toString());
ScanDataMessage scanDataMessage = new ScanDataMessage(orgId, scanId, traceId, actorId, scanType, body, Instant.now().toString());

topicDetails.put("orgId", orgId);
topicDetails.put("runtimeAgentId", runtimeAgentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ public void process(Exchange exchange) throws Exception {
ILoggingEvent event = (ILoggingEvent) exchange.getIn().getBody();
String scanId = (String) properties.get(RouteConstants.SCAN_ID);
String traceId = (String) properties.get(RouteConstants.TRACE_ID);
String actorId = (String) properties.get(RouteConstants.ACTOR_ID);
String messagingServiceId = (String) properties.get(RouteConstants.MESSAGING_SERVICE_ID);

ScanLogMessage logDataMessage = new ScanLogMessage(orgId, scanId, traceId, event.getLevel().toString(),
ScanLogMessage logDataMessage = new ScanLogMessage(orgId, scanId, traceId, actorId, event.getLevel().toString(),
String.format("%s%s", event.getFormattedMessage(), "\n"), event.getTimeStamp());

topicDetails.put("orgId", orgId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public void process(Exchange exchange) throws Exception {
String messagingServiceId = (String) properties.get(RouteConstants.MESSAGING_SERVICE_ID);
String scanId = (String) properties.get(RouteConstants.SCAN_ID);
String traceId = (String) properties.get(RouteConstants.TRACE_ID);
String actorId = (String) properties.get(RouteConstants.ACTOR_ID);
ScanStatus status = (ScanStatus) properties.get(RouteConstants.SCAN_STATUS);
String description = (String) properties.get(RouteConstants.SCAN_STATUS_DESC);

Expand All @@ -54,7 +55,7 @@ public void process(Exchange exchange) throws Exception {
topicDetails.put("scanType", scanType);
topicDetails.put("status", status.name());

ScanStatusMessage generalStatusMessage = new ScanStatusMessage(orgId, scanId, traceId, status.name(), description, scanTypes);
ScanStatusMessage generalStatusMessage = new ScanStatusMessage(orgId, scanId, traceId, actorId, status.name(), description, scanTypes);

exchange.getIn().setHeader(RouteConstants.GENERAL_STATUS_MESSAGE, generalStatusMessage);
exchange.getIn().setHeader(RouteConstants.TOPIC_DETAILS, topicDetails);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public void process(Exchange exchange) throws Exception {
String messagingServiceId = (String) properties.get(RouteConstants.MESSAGING_SERVICE_ID);
String scanId = (String) properties.get(RouteConstants.SCAN_ID);
String traceId = (String) properties.get(RouteConstants.TRACE_ID);
String actorId = (String) properties.get(RouteConstants.ACTOR_ID);
String scanType = (String) properties.get(RouteConstants.SCAN_TYPE);
ScanStatus status = (ScanStatus) properties.get(RouteConstants.SCAN_STATUS);
String description = (String) properties.get(RouteConstants.SCAN_STATUS_DESC);
Expand All @@ -49,7 +50,8 @@ public void process(Exchange exchange) throws Exception {
topicDetails.put("status", status.name());
topicDetails.put("scanDataType", scanType);

ScanDataStatusMessage scanDataStatusMessage = new ScanDataStatusMessage(orgId, scanId, traceId, status.name(), description, scanType);
ScanDataStatusMessage scanDataStatusMessage = new ScanDataStatusMessage(orgId, scanId, traceId, actorId,
status.name(), description, scanType);

exchange.getIn().setHeader(RouteConstants.SCAN_DATA_STATUS_MESSAGE, scanDataStatusMessage);
exchange.getIn().setHeader(RouteConstants.TOPIC_DETAILS, topicDetails);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import com.solace.maas.ep.event.management.agent.plugin.processor.ScanTypeDescendentsProcessor;
import com.solace.maas.ep.event.management.agent.repository.model.scan.ScanRecipientHierarchyEntity;
import com.solace.maas.ep.event.management.agent.repository.scan.ScanRecipientHierarchyRepository;
import jakarta.transaction.Transactional;
import lombok.extern.slf4j.Slf4j;
import org.apache.camel.Exchange;
import org.springframework.stereotype.Component;

import jakarta.transaction.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand All @@ -33,6 +33,7 @@ public void process(Exchange exchange) throws Exception {

String scanId = (String) properties.get(RouteConstants.SCAN_ID);
String traceId = (String) properties.get(RouteConstants.TRACE_ID);
String actorId = (String) properties.get(RouteConstants.ACTOR_ID);
String scanType = (String) properties.get(RouteConstants.SCAN_TYPE);
boolean isEmptyScanTypes = (boolean) properties.get(RouteConstants.IS_EMPTY_SCAN_TYPES);

Expand All @@ -43,7 +44,8 @@ public void process(Exchange exchange) throws Exception {

if (isEmptyScanTypes) {
allDescendentScanTypes.forEach(type ->
log.info("Scan request [{}], trace ID [{}]: Encountered an empty scan type [{}].", scanId, traceId, type));
log.info("Scan request [{}], trace ID [{}], actor ID [{}]: Encountered an empty scan type [{}].",
scanId, traceId, actorId, type));
}

exchange.getIn().setHeader(RouteConstants.SCAN_TYPE, allDescendentScanTypes);
Expand Down
Loading

0 comments on commit d488242

Please sign in to comment.