Use Kafka
This commit is contained in:
parent
fd551f7af8
commit
a79802646c
37 changed files with 814 additions and 658 deletions
|
|
@ -216,7 +216,102 @@ services:
|
|||
command: mongod
|
||||
restart: always
|
||||
|
||||
zoo1:
|
||||
image: zookeeper:3.4.9
|
||||
hostname: zoo1
|
||||
ports:
|
||||
- "2181:2181"
|
||||
environment:
|
||||
ZOO_MY_ID: 1
|
||||
ZOO_PORT: 2181
|
||||
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
|
||||
volumes:
|
||||
- zoo1_data:/data
|
||||
- zoo1_data_datalog:/datalog
|
||||
|
||||
zoo2:
|
||||
image: zookeeper:3.4.9
|
||||
hostname: zoo2
|
||||
ports:
|
||||
- "2182:2182"
|
||||
environment:
|
||||
ZOO_MY_ID: 2
|
||||
ZOO_PORT: 2182
|
||||
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
|
||||
volumes:
|
||||
- zoo2_data:/data
|
||||
- zoo2_data_datalog:/datalog
|
||||
|
||||
zoo3:
|
||||
image: zookeeper:3.4.9
|
||||
hostname: zoo3
|
||||
ports:
|
||||
- "2183:2183"
|
||||
environment:
|
||||
ZOO_MY_ID: 3
|
||||
ZOO_PORT: 2183
|
||||
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888
|
||||
volumes:
|
||||
- zoo3_data:/data
|
||||
- zoo3_data_datalog:/datalog
|
||||
|
||||
|
||||
kafka1:
|
||||
image: confluentinc/cp-kafka:5.5.0
|
||||
hostname: kafka1
|
||||
ports:
|
||||
- "9092:9092"
|
||||
environment:
|
||||
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka1:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
||||
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183"
|
||||
KAFKA_BROKER_ID: 1
|
||||
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
||||
volumes:
|
||||
- kafka1_data:/var/lib/kafka/data
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
|
||||
kafka2:
|
||||
image: confluentinc/cp-kafka:5.5.0
|
||||
hostname: kafka2
|
||||
ports:
|
||||
- "9093:9093"
|
||||
environment:
|
||||
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka2:19093,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9093
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
||||
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183"
|
||||
KAFKA_BROKER_ID: 2
|
||||
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
||||
volumes:
|
||||
- kafka2_data:/var/lib/kafka/data
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
|
||||
kafka3:
|
||||
image: confluentinc/cp-kafka:5.5.0
|
||||
hostname: kafka3
|
||||
ports:
|
||||
- "9094:9094"
|
||||
environment:
|
||||
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka3:19094,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9094
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
|
||||
KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181,zoo2:2182,zoo3:2183"
|
||||
KAFKA_BROKER_ID: 3
|
||||
KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
|
||||
volumes:
|
||||
- kafka3_data:/var/lib/kafka/data
|
||||
depends_on:
|
||||
- zoo1
|
||||
- zoo2
|
||||
- zoo3
|
||||
|
||||
volumes:
|
||||
mongodb:
|
||||
|
|
@ -224,3 +319,12 @@ volumes:
|
|||
gitdata:
|
||||
lucenedata:
|
||||
kieserverdir:
|
||||
zoo1_data:
|
||||
zoo2_data:
|
||||
zoo3_data:
|
||||
zoo1_data_datalog:
|
||||
zoo2_data_datalog:
|
||||
zoo3_data_datalog:
|
||||
kafka1_data:
|
||||
kafka2_data:
|
||||
kafka3_data:
|
||||
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
<properties>
|
||||
<vaadin.version>12.0.5</vaadin.version>
|
||||
<spring-boot.version>2.1.2.RELEASE</spring-boot.version>
|
||||
<spring-version>5.1.2.RELEASE</spring-version>
|
||||
<spring-boot.version>${spring.boot.version}</spring-boot.version>
|
||||
<spring-version>${spring.version}</spring-version>
|
||||
<webapp.directory>src/main/webapp</webapp.directory>
|
||||
</properties>
|
||||
|
||||
|
|
@ -60,7 +60,11 @@
|
|||
<artifactId>poi</artifactId>
|
||||
<version>4.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
<version>${kafka.version}</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
|
|
@ -159,12 +163,12 @@
|
|||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.9.4</version>
|
||||
<version>2.10.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.9.4</version>
|
||||
<version>2.10.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
package org.chtijbug.drools.console;
|
||||
|
||||
|
||||
import org.apache.kafka.clients.admin.AdminClientConfig;
|
||||
import org.apache.kafka.clients.admin.NewTopic;
|
||||
import org.apache.kafka.clients.producer.ProducerConfig;
|
||||
import org.apache.kafka.common.serialization.StringSerializer;
|
||||
import org.chtijbug.drools.ReverseProxyUpdate;
|
||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||
import org.chtijbug.drools.console.middle.DababaseContentInit;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieConfigurationData;
|
||||
import org.chtijbug.drools.console.service.util.ApplicationContextProvider;
|
||||
|
|
@ -11,20 +17,34 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.*;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||
import org.springframework.kafka.annotation.EnableKafka;
|
||||
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
|
||||
import org.springframework.kafka.core.KafkaAdmin;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.kafka.core.ProducerFactory;
|
||||
import org.springframework.kafka.support.serializer.JsonSerializer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@SpringBootApplication
|
||||
@EnableMongoRepositories("org.chtijbug.drools.proxy.persistence.repository")
|
||||
|
||||
@EnableKafka
|
||||
@PropertySource("classpath:application.properties")
|
||||
public class DroolsSpringBootConsoleApplication extends SpringBootServletInitializer {
|
||||
|
||||
@Value("${kie-wb.baseurl}")
|
||||
private String kiewbUrl;
|
||||
|
||||
@Value(value = "${kafka.bootstrapAddress}")
|
||||
private String bootstrapAddress;
|
||||
|
||||
@Autowired
|
||||
private DababaseContentInit dababaseContentInit;
|
||||
|
||||
|
|
@ -45,6 +65,39 @@ public class DroolsSpringBootConsoleApplication extends SpringBootServletInitial
|
|||
return application.sources(DroolsSpringBootConsoleApplication.class);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public KafkaAdmin kafkaAdmin() {
|
||||
Map<String, Object> configs = new HashMap<>();
|
||||
configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
||||
return new KafkaAdmin(configs);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NewTopic loggingTopic() {
|
||||
return new NewTopic(KafkaTopicConstants.REVERSE_PROXY, 1, (short) 1);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ProducerFactory<String, ReverseProxyUpdate> producerFactory() {
|
||||
Map<String, Object> configProps = new HashMap<>();
|
||||
configProps.put(
|
||||
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
|
||||
bootstrapAddress);
|
||||
configProps.put(
|
||||
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
|
||||
StringSerializer.class);
|
||||
configProps.put(
|
||||
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
|
||||
JsonSerializer.class);
|
||||
return new DefaultKafkaProducerFactory<>(configProps);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public KafkaTemplate<String, ReverseProxyUpdate> kafkaTemplate() {
|
||||
return new KafkaTemplate<>(producerFactory());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DroolsSpringBootConsoleApplication.class, args);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class ElasticSearchExpose {
|
|||
|
||||
BusinessTransactionPersistence tmp=null;
|
||||
|
||||
List<BusinessTransactionPersistence> businessTransactionPersistences = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(transactionId,new PageRequest(0,5000));
|
||||
List<BusinessTransactionPersistence> businessTransactionPersistences = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(transactionId,PageRequest.of(0,5000));
|
||||
|
||||
if(businessTransactionPersistences!=null) {
|
||||
for (BusinessTransactionPersistence b : businessTransactionPersistences) {
|
||||
|
|
@ -46,7 +46,7 @@ public class ElasticSearchExpose {
|
|||
@RequestMapping(value = "/findActionByBusinessId", method = RequestMethod.GET)
|
||||
public List<BusinessTransactionAction> findActionById(@RequestParam String businessId, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
List<BusinessTransactionAction> businessTransactionPersistences = indexerService.getBusinessTransactionActionRepository().findAllByBusinessTransactionId(businessId,new Sort(new Sort.Order(Sort.Direction.ASC,"eventNumber")),new PageRequest(0,5000));
|
||||
List<BusinessTransactionAction> businessTransactionPersistences = indexerService.getBusinessTransactionActionRepository().findAllByBusinessTransactionId(businessId,Sort.by(new Sort.Order(Sort.Direction.ASC,"eventNumber")),PageRequest.of(0,5000));
|
||||
|
||||
return businessTransactionPersistences;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package org.chtijbug.drools.console.service;
|
|||
|
||||
import com.vaadin.flow.component.UI;
|
||||
import com.vaadin.flow.server.VaadinSession;
|
||||
import org.chtijbug.drools.ReverseProxyUpdate;
|
||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||
import org.chtijbug.drools.console.AddLog;
|
||||
import org.chtijbug.drools.console.service.model.UserConnected;
|
||||
import org.chtijbug.drools.console.service.model.kie.JobStatus;
|
||||
|
|
@ -21,6 +23,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -56,6 +59,8 @@ public class ProjectPersistService {
|
|||
|
||||
@Autowired
|
||||
private RuntimeRepository runtimeRepository;
|
||||
@Autowired
|
||||
private KafkaTemplate<String, ReverseProxyUpdate> kafkaTemplateProxyUpdate;
|
||||
|
||||
public ProjectPersistService() {
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
|
|
@ -63,18 +68,16 @@ public class ProjectPersistService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void saveIfnotExist(List<PlatformProjectResponse> platformProjectResponses) {
|
||||
|
||||
for (PlatformProjectResponse platformProjectResponse : platformProjectResponses) {
|
||||
|
||||
ProjectPersist projectPersist = projectRepository.findByProjectNameAndBranch(new KieProject(platformProjectResponse.getSpaceName(), platformProjectResponse.getName()),platformProjectResponse.getBranch());
|
||||
ProjectPersist projectPersist = projectRepository.findByProjectNameAndBranch(new KieProject(platformProjectResponse.getSpaceName(), platformProjectResponse.getName()), platformProjectResponse.getBranch());
|
||||
|
||||
if (projectPersist == null) {
|
||||
projectPersist = platformProjectResponseToProjectPersist(platformProjectResponse);
|
||||
|
||||
projectPersist=projectRepository.save(projectPersist);
|
||||
projectPersist = projectRepository.save(projectPersist);
|
||||
addProjectToSession(projectPersist, true);
|
||||
|
||||
} else {
|
||||
|
|
@ -101,12 +104,12 @@ public class ProjectPersistService {
|
|||
}
|
||||
|
||||
if (isModifiable) {
|
||||
projectPersists.put(projectPersist.getProjectName().toString()+"-"+projectPersist.getBranch(), projectPersist);
|
||||
projectPersists.put(projectPersist.getProjectName().toString() + "-" + projectPersist.getBranch(), projectPersist);
|
||||
} else {
|
||||
|
||||
ProjectPersist tmp = projectPersists.get(projectPersist.getProjectName().toString()+"-"+projectPersist.getBranch());
|
||||
ProjectPersist tmp = projectPersists.get(projectPersist.getProjectName().toString() + "-" + projectPersist.getBranch());
|
||||
if (tmp == null) {
|
||||
projectPersists.put(projectPersist.getProjectName().toString()+"-"+projectPersist.getBranch(), projectPersist);
|
||||
projectPersists.put(projectPersist.getProjectName().toString() + "-" + projectPersist.getBranch(), projectPersist);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -117,6 +120,8 @@ public class ProjectPersistService {
|
|||
projectPersist.setStatus(ProjectPersist.Deployable);
|
||||
projectPersist.setContainerID(projectPersist.getDeploymentName() + "-" + projectPersist.getProjectName());
|
||||
projectPersist.getServerNames().clear();
|
||||
ReverseProxyUpdate reverseProxyUpdate = new ReverseProxyUpdate();
|
||||
reverseProxyUpdate.setPath("/" + projectPersist.getContainerID());
|
||||
for (RuntimePersist runtimePersist : runtimePersists) {
|
||||
List<String> names = new ArrayList<>();
|
||||
names.add(runtimePersist.getServerName());
|
||||
|
|
@ -132,14 +137,14 @@ public class ProjectPersistService {
|
|||
newContainer.setArtifactId(projectPersist.getArtifactID());
|
||||
newContainer.setVersion(projectPersist.getProjectVersion());
|
||||
containerRepository.save(newContainer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
String hostName = runtimePersist.getServerUrl() + "/api/" + projectPersist.getContainerID();
|
||||
reverseProxyUpdate.getServerNames().add(hostName);
|
||||
}
|
||||
projectRepository.save(projectPersist);
|
||||
|
||||
addProjectToSession(projectPersist, true);
|
||||
|
||||
kafkaTemplateProxyUpdate.send(KafkaTopicConstants.REVERSE_PROXY, reverseProxyUpdate);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -173,12 +178,12 @@ public class ProjectPersistService {
|
|||
public void run() {
|
||||
|
||||
JobStatus result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
||||
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(),projectPersist.getBranch(), "compile", workOnGoingView, ui);
|
||||
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(), projectPersist.getBranch(), "compile", workOnGoingView, ui);
|
||||
|
||||
executeWrite(url, username, password, workOnGoingView, result.getJobId(), ui);
|
||||
|
||||
result = kieRepositoryService.buildProject(config.getKiewbUrl(), userConnected.getUserName(),
|
||||
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(),projectPersist.getBranch(), "install", workOnGoingView, ui);
|
||||
userConnected.getUserPassword(), projectPersist.getProjectName().getSpaceName(), projectPersist.getProjectName().getName(), projectPersist.getBranch(), "install", workOnGoingView, ui);
|
||||
|
||||
executeWrite(url, username, password, workOnGoingView, result.getJobId(), ui);
|
||||
|
||||
|
|
@ -230,7 +235,7 @@ public class ProjectPersistService {
|
|||
this.wait(1000);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
logger.error("executeWrite",e);
|
||||
logger.error("executeWrite", e);
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
|||
|
||||
public void setDataProvider(String id){
|
||||
|
||||
List<BusinessTransactionAction> businessTransactionPersistences = indexerService.getBusinessTransactionActionRepository().findAllByBusinessTransactionId(id,new Sort(new Sort.Order(Sort.Direction.ASC,"eventNumber")),new PageRequest(0,5000));
|
||||
List<BusinessTransactionAction> businessTransactionPersistences = indexerService.getBusinessTransactionActionRepository().findAllByBusinessTransactionId(id,Sort.by(new Sort.Order(Sort.Direction.ASC,"eventNumber")),PageRequest.of(0,5000));
|
||||
|
||||
if(businessTransactionPersistences!=null) {
|
||||
dataProvider = new ListDataProvider<>(businessTransactionPersistences);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ public class GridLogging extends Grid<BusinessTransactionPersistence> {
|
|||
});
|
||||
serverNameC.setHeader(serverName);
|
||||
|
||||
setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(new PageRequest(0,100)).getContent());
|
||||
setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(PageRequest.of(0,100)).getContent());
|
||||
}
|
||||
private void refreshtGrid(String value,String type){
|
||||
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ public class ActionLogging extends VerticalLayout {
|
|||
|
||||
if (textFieldStringComponentValueChangeEvent.getValue().isEmpty()) {
|
||||
loggingView.getTitle().setText("Logging : ");
|
||||
loggingView.getGridLogging().setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(new PageRequest(0, 100)).getContent());
|
||||
loggingView.getGridLogging().setDataProvider(indexerService.getBusinessTransactionPersistenceRepository().findAll(PageRequest.of(0, 100)).getContent());
|
||||
} else {
|
||||
List<BusinessTransactionPersistence> b = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(textFieldStringComponentValueChangeEvent.getValue(), new PageRequest(0, 100));
|
||||
List<BusinessTransactionPersistence> b = indexerService.getBusinessTransactionPersistenceRepository().findAllByTransactionId(textFieldStringComponentValueChangeEvent.getValue(), PageRequest.of(0, 100));
|
||||
|
||||
if (b != null) {
|
||||
loggingView.getTitle().setText("Logging : " + textFieldStringComponentValueChangeEvent.getValue());
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class DeploymentView extends VerticalLayout implements AddLog {
|
||||
|
|
@ -215,7 +215,7 @@ public class DeploymentView extends VerticalLayout implements AddLog {
|
|||
|
||||
public void setDataProvider() {
|
||||
|
||||
HashMap<String, ProjectPersist> projectPersists = projectPersistService.getProjectsSession();
|
||||
Map<String, ProjectPersist> projectPersists = projectPersistService.getProjectsSession();
|
||||
if (projectPersists != null) {
|
||||
dataProvider = new ListDataProvider<>(projectPersists.values());
|
||||
|
||||
|
|
|
|||
|
|
@ -13,3 +13,4 @@ spring.data.mongodb.database=businessProxyDB
|
|||
spring.data.mongodb.host=localhost:28017
|
||||
|
||||
spring.servlet.multipart.enabled=false
|
||||
kafka.bootstrapAddress=localhost:9092,localhost:9093,localhost:9094
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package org.chtijbug.drools.common;
|
||||
|
||||
public class KafkaTopicConstants {
|
||||
public final static String LOGING_TOPIC ="logging";
|
||||
public final static String RESPONSE_TOPIC ="Response";
|
||||
public final static String REVERSE_PROXY="proxy";
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ import org.chtijbug.drools.common.rest.MultipleInputs;
|
|||
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
||||
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
|
||||
import org.chtijbug.drools.logging.SessionExecution;
|
||||
import org.chtijbug.kieserver.services.drools.ChtijbugObjectRequest;
|
||||
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||
import org.chtijbug.kieserver.services.drools.DroolsChtijbugRulesExecutionService;
|
||||
import org.kie.server.services.api.KieContainerInstance;
|
||||
import org.kie.server.services.api.KieServerRegistry;
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
package org.chtijbug.kieserver.services.drools;
|
||||
|
||||
import org.chtijbug.drools.SessionContext;
|
||||
|
||||
/**
|
||||
* Created by nheron on 07/07/2016.
|
||||
*/
|
||||
public class ChtijbugObjectRequest {
|
||||
|
||||
private Object objectRequest;
|
||||
|
||||
private SessionContext sessionLogging;
|
||||
|
||||
public Object getObjectRequest() {
|
||||
return objectRequest;
|
||||
}
|
||||
|
||||
public void setObjectRequest(Object objectRequest) {
|
||||
this.objectRequest = objectRequest;
|
||||
}
|
||||
|
||||
public SessionContext getSessionLogging() {
|
||||
return sessionLogging;
|
||||
}
|
||||
|
||||
public void setSessionLogging(SessionContext sessionLogging) {
|
||||
this.sessionLogging = sessionLogging;
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
package org.chtijbug.kieserver.services.drools;
|
||||
|
||||
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||
import org.chtijbug.drools.SessionContext;
|
||||
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
||||
import org.chtijbug.drools.kieserver.extension.KieServerGlobalVariableDefinition;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,105 @@
|
|||
package org.chtijbug.drools;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* Created by nheron on 07/07/2016.
|
||||
*/
|
||||
public class ChtijbugObjectRequest {
|
||||
|
||||
|
||||
private String transactionID;
|
||||
private LocalDateTime transactionStartTimeStamp;
|
||||
private LocalDateTime transactionEndTimeStamp;
|
||||
|
||||
private String processID;
|
||||
private String containerID;
|
||||
|
||||
private String artifactID;
|
||||
private String groupID;
|
||||
private String version;
|
||||
|
||||
private Object objectRequest;
|
||||
|
||||
private SessionContext sessionLogging;
|
||||
|
||||
public String getTransactionID() {
|
||||
return transactionID;
|
||||
}
|
||||
|
||||
public void setTransactionID(String transactionID) {
|
||||
this.transactionID = transactionID;
|
||||
}
|
||||
|
||||
public LocalDateTime getTransactionStartTimeStamp() {
|
||||
return transactionStartTimeStamp;
|
||||
}
|
||||
|
||||
public void setTransactionStartTimeStamp(LocalDateTime transactionStartTimeStamp) {
|
||||
this.transactionStartTimeStamp = transactionStartTimeStamp;
|
||||
}
|
||||
|
||||
public LocalDateTime getTransactionEndTimeStamp() {
|
||||
return transactionEndTimeStamp;
|
||||
}
|
||||
|
||||
public void setTransactionEndTimeStamp(LocalDateTime transactionEndTimeStamp) {
|
||||
this.transactionEndTimeStamp = transactionEndTimeStamp;
|
||||
}
|
||||
|
||||
public Object getObjectRequest() {
|
||||
return objectRequest;
|
||||
}
|
||||
|
||||
public void setObjectRequest(Object objectRequest) {
|
||||
this.objectRequest = objectRequest;
|
||||
}
|
||||
|
||||
public SessionContext getSessionLogging() {
|
||||
return sessionLogging;
|
||||
}
|
||||
|
||||
public void setSessionLogging(SessionContext sessionLogging) {
|
||||
this.sessionLogging = sessionLogging;
|
||||
}
|
||||
|
||||
public String getProcessID() {
|
||||
return processID;
|
||||
}
|
||||
|
||||
public void setProcessID(String processID) {
|
||||
this.processID = processID;
|
||||
}
|
||||
|
||||
public String getContainerID() {
|
||||
return containerID;
|
||||
}
|
||||
|
||||
public void setContainerID(String containerID) {
|
||||
this.containerID = containerID;
|
||||
}
|
||||
|
||||
public String getArtifactID() {
|
||||
return artifactID;
|
||||
}
|
||||
|
||||
public void setArtifactID(String artifactID) {
|
||||
this.artifactID = artifactID;
|
||||
}
|
||||
|
||||
public String getGroupID() {
|
||||
return groupID;
|
||||
}
|
||||
|
||||
public void setGroupID(String groupID) {
|
||||
this.groupID = groupID;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package org.chtijbug.drools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ReverseProxyUpdate {
|
||||
private String path;
|
||||
|
||||
List<String> serverNames = new ArrayList<>();
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public List<String> getServerNames() {
|
||||
return serverNames;
|
||||
}
|
||||
|
||||
public void setServerNames(List<String> serverNames) {
|
||||
this.serverNames = serverNames;
|
||||
}
|
||||
}
|
||||
|
|
@ -23,80 +23,65 @@
|
|||
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.23.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie:kie-api:7.23.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.23.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.13.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-undertow:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.undertow:undertow-core:2.0.14.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.xnio:xnio-api:3.3.8.Final" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jboss.xnio:xnio-nio:3.3.8.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.undertow:undertow-servlet:2.0.14.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:1.0.2.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.undertow:undertow-websockets-jsr:2.0.14.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.spec.javax.websocket:jboss-websocket-api_1.1_spec:1.1.3.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.glassfish:javax.el:3.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-spring-boot-starter:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-spring-boot:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-spring:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-core-starter:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-quartz2:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-core:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.quartz-scheduler:quartz:2.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.5.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-core:2.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.12.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.12.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.10.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.10.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.10.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.33" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.33" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.33" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.kafka:spring-kafka:2.3.7.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.luben:zstd-jni:1.4.0-1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.lz4:lz4-java:1.6.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.xerial.snappy:snappy-java:1.1.7.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="module" module-name="drools-framework-business-proxy-persistence" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-mongodb:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver:3.8.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.8.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.8.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-mongodb:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-ftp:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.jcraft:jsch:0.1.54" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-net:commons-net:3.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-mongodb:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver:3.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-mongodb:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.10.3" level="project" />
|
||||
<orderEntry type="module" module-name="drools-framework-runtime-entity" />
|
||||
<orderEntry type="module" module-name="drools-framework-common" />
|
||||
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest:2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.10.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.38.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie:kie-api:7.38.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.38.0.Final" level="project" />
|
||||
|
|
|
|||
|
|
@ -21,13 +21,6 @@
|
|||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-spring-boot-dependencies</artifactId>
|
||||
<version>${camel.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
@ -37,31 +30,23 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Camel -->
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-quartz2</artifactId>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
<version>${kafka.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- kie-server -->
|
||||
<!--dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.9.7</version>
|
||||
</dependency-->
|
||||
<dependency>
|
||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||
<artifactId>drools-framework-business-proxy-persistence</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-ftp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||
<artifactId>drools-framework-runtime-entity</artifactId>
|
||||
|
|
|
|||
|
|
@ -16,18 +16,51 @@
|
|||
*/
|
||||
package org.chtijbug.drools.indexer;
|
||||
|
||||
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||
import org.apache.kafka.common.serialization.StringDeserializer;
|
||||
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||
import org.springframework.kafka.annotation.EnableKafka;
|
||||
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
|
||||
import org.springframework.kafka.core.ConsumerFactory;
|
||||
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
|
||||
import org.springframework.kafka.support.serializer.JsonDeserializer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
// CHECKSTYLE:OFF
|
||||
@SpringBootApplication
|
||||
@Configuration
|
||||
@EnableMongoRepositories(basePackages = "org.chtijbug.drools.proxy.persistence.repository")
|
||||
|
||||
@EnableKafka
|
||||
public class DroolsBusinessIndexerServer {
|
||||
public final static String LOGING_TOPIC ="logging";
|
||||
@Value(value = "${kafka.bootstrapAddress}")
|
||||
private String bootstrapAddress;
|
||||
|
||||
|
||||
|
||||
public ConsumerFactory<String, ChtijbugObjectRequest> greetingConsumerFactory() {
|
||||
Map<String, Object> props = new HashMap<>();
|
||||
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
||||
props.put(ConsumerConfig.GROUP_ID_CONFIG, "greeting");
|
||||
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(ChtijbugObjectRequest.class));
|
||||
}
|
||||
@Bean
|
||||
public ConcurrentKafkaListenerContainerFactory<String, ChtijbugObjectRequest>
|
||||
ruleKafkaListenerContainerFactory() {
|
||||
|
||||
ConcurrentKafkaListenerContainerFactory<String, ChtijbugObjectRequest> factory =
|
||||
new ConcurrentKafkaListenerContainerFactory<>();
|
||||
factory.setConsumerFactory(greetingConsumerFactory());
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
package org.chtijbug.drools.indexer.route;
|
||||
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class DeclareNewSftpRouter extends RouteBuilder {
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
from("quartz2://myGroup/myTimerName?cron=0/5+*+*+?+*+*").to("bean:startRouteService?method=updateConfig()");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package org.chtijbug.drools.indexer.route;
|
||||
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
|
||||
|
||||
public class IndexerRoute extends RouteBuilder {
|
||||
|
||||
private String login;
|
||||
|
||||
private String password;
|
||||
|
||||
private String host;
|
||||
|
||||
private String port;
|
||||
|
||||
private String id;
|
||||
|
||||
public IndexerRoute(String id,String login, String password, String host, String port) {
|
||||
this.login = login;
|
||||
this.password = password;
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.id=id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
//from("sftp://foo@myserver?password=secret&ftpClient.dataTimeout=30000").to("bean:foo");
|
||||
String url="sftp://"+login+"@"+host+":"+port+"?password="+password+"&move=.done";
|
||||
from(url).routeId(id).to("bean:storeService?method=store(${header.CamelFileName},${body})");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
package org.chtijbug.drools.indexer.service;
|
||||
|
||||
|
||||
import org.apache.camel.CamelContext;
|
||||
import org.chtijbug.drools.indexer.route.IndexerRoute;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.RuntimeRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("startRouteService")
|
||||
public class StartRouteService {
|
||||
@Value("${kieserver.login}")
|
||||
private String login;
|
||||
@Value("${kieserver.password}")
|
||||
private String password;
|
||||
@Autowired
|
||||
CamelContext camelContext;
|
||||
@Autowired
|
||||
RuntimeRepository runtimeRepository;
|
||||
|
||||
|
||||
private Map<String,RuntimePersist> routes = new HashMap<>();
|
||||
private Map<String,IndexerRoute> routesCamel = new HashMap<>();
|
||||
|
||||
|
||||
|
||||
public void updateConfig() throws Exception {
|
||||
for (RuntimePersist runtime : runtimeRepository.findAll()){
|
||||
if (routes.containsKey(runtime.getId())==false){
|
||||
IndexerRoute indexerRoute =new IndexerRoute(runtime.getId(),login,password,runtime.getSftpHost(),runtime.getSftpPort());
|
||||
camelContext.addRoutes(indexerRoute);
|
||||
routes.put(runtime.getSftpHost()+":"+runtime.getSftpPort(),runtime.duplicate());
|
||||
routesCamel.put(runtime.getSftpHost()+":"+runtime.getSftpPort(),indexerRoute);
|
||||
}else{
|
||||
RuntimePersist existingRoutes = routes.get(runtime.getId());
|
||||
if (!existingRoutes.getSftpHost().equals(runtime.getSftpHost())
|
||||
|| !existingRoutes.getSftpPort().equals(runtime.getSftpPort())){
|
||||
//routes must be reloaded
|
||||
IndexerRoute routeToDelete=routesCamel.get(runtime.getId());
|
||||
routesCamel.remove(runtime.getId());
|
||||
camelContext.removeRoute(runtime.getId());
|
||||
routes.remove(runtime.getId());
|
||||
|
||||
IndexerRoute indexerRoute =new IndexerRoute(runtime.getId(),login,password,runtime.getSftpHost(),runtime.getSftpPort());
|
||||
camelContext.addRoutes(indexerRoute);
|
||||
routes.put(runtime.getId(),runtime.duplicate());
|
||||
routesCamel.put(runtime.getId(),indexerRoute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void constructIndexerRoute() throws Exception {
|
||||
for (RuntimePersist runtime : runtimeRepository.findAll()){
|
||||
IndexerRoute indexerRoute =new IndexerRoute(runtime.getId(),login,password,runtime.getSftpHost(),runtime.getSftpPort());
|
||||
camelContext.addRoutes(indexerRoute);
|
||||
|
||||
routes.put(runtime.getId(),runtime.duplicate());
|
||||
routesCamel.put(runtime.getId(),indexerRoute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
package org.chtijbug.drools.indexer.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||
import org.chtijbug.drools.SessionContext;
|
||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||
import org.chtijbug.drools.logging.*;
|
||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionAction;
|
||||
import org.chtijbug.drools.proxy.persistence.model.BusinessTransactionPersistence;
|
||||
|
|
@ -9,34 +10,34 @@ import org.chtijbug.drools.proxy.persistence.model.EventType;
|
|||
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionActionRepository;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.BusinessTransactionPersistenceRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.kafka.annotation.KafkaListener;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@Service("storeService")
|
||||
public class StoreLoggingService {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@Autowired
|
||||
private BusinessTransactionPersistenceRepository transactionRepository;
|
||||
|
||||
@Autowired
|
||||
private BusinessTransactionActionRepository actionRepository;
|
||||
|
||||
public void store(String fileName, String fileContent) {
|
||||
if (fileName!= null) {
|
||||
@KafkaListener(
|
||||
topics = KafkaTopicConstants.LOGING_TOPIC,
|
||||
containerFactory = "ruleKafkaListenerContainerFactory")
|
||||
public void store(ChtijbugObjectRequest result) {
|
||||
if (result != null) {
|
||||
|
||||
String[] data = fileName.split("-");
|
||||
Integer year = Integer.valueOf(data[0]);
|
||||
Integer month = Integer.valueOf(data[1]);
|
||||
Integer day = Integer.valueOf(data[2]);
|
||||
Integer hour = Integer.valueOf(data[3]);
|
||||
Integer minute = Integer.valueOf(data[4]);
|
||||
Integer second = Integer.valueOf(data[5]);
|
||||
Integer millis = Integer.valueOf(data[6]);
|
||||
String id = data[7].substring(0,data[7].indexOf("."));
|
||||
Integer year = result.getTransactionStartTimeStamp().getYear();
|
||||
Integer month = result.getTransactionStartTimeStamp().getMonthValue();
|
||||
Integer day = result.getTransactionStartTimeStamp().getDayOfMonth();
|
||||
Integer hour = result.getTransactionStartTimeStamp().getHour();
|
||||
Integer minute = result.getTransactionStartTimeStamp().getMinute();
|
||||
Integer second = result.getTransactionStartTimeStamp().getSecond();
|
||||
Integer millis = result.getTransactionStartTimeStamp().getNano();
|
||||
String id = result.getTransactionID();
|
||||
BusinessTransactionPersistence item = new BusinessTransactionPersistence();
|
||||
item.setYear(year);
|
||||
item.setMonth(month);
|
||||
|
|
@ -47,9 +48,9 @@ public class StoreLoggingService {
|
|||
item.setMillis(millis);
|
||||
item.setTransactionId(id);
|
||||
item.setId(UUID.randomUUID().toString());
|
||||
long ii=1;
|
||||
try {
|
||||
SessionContext sessionContext = mapper.readValue(fileContent,SessionContext.class);
|
||||
long ii = 1;
|
||||
|
||||
SessionContext sessionContext = result.getSessionLogging();
|
||||
item.setContainerId(sessionContext.getContainerId());
|
||||
item.setGroupID(sessionContext.getGroupID());
|
||||
item.setArtefactID(sessionContext.getArtefactID());
|
||||
|
|
@ -58,44 +59,44 @@ public class StoreLoggingService {
|
|||
item.setServerName(sessionContext.getServerName());
|
||||
Map<Long, BusinessTransactionAction> actions = new HashMap<>();
|
||||
SessionExecution sessionExecution = sessionContext.getSessionExecution();
|
||||
BusinessTransactionAction businessTransactionoutput=null;
|
||||
for (Fact fact : sessionExecution.getFacts()){
|
||||
BusinessTransactionAction businessTransactionoutput = null;
|
||||
for (Fact fact : sessionExecution.getFacts()) {
|
||||
BusinessTransactionAction businessTransactionAction = new BusinessTransactionAction();
|
||||
businessTransactionAction.setId(UUID.randomUUID().toString());
|
||||
businessTransactionAction.setBusinessTransactionId(item.getId());
|
||||
if (fact.getFactType().equals(FactType.INPUTDATA)){
|
||||
if (fact.getFactType().equals(FactType.INPUTDATA)) {
|
||||
businessTransactionAction.setEventType(EventType.INPUT);
|
||||
businessTransactionAction.setInputData(fact);
|
||||
businessTransactionAction.setEventNumber(0);
|
||||
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
||||
}else if (fact.getFactType().equals(FactType.OUTPUTDATA)){
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.OUTPUTDATA)) {
|
||||
businessTransactionAction.setEventType(EventType.OUPUT);
|
||||
businessTransactionAction.setOutputData(fact);
|
||||
businessTransactionoutput=businessTransactionAction;
|
||||
businessTransactionoutput = businessTransactionAction;
|
||||
|
||||
}else if (fact.getFactType().equals(FactType.INSERTED)){
|
||||
} else if (fact.getFactType().equals(FactType.INSERTED)) {
|
||||
businessTransactionAction.setEventType(EventType.INSERTFACT);
|
||||
businessTransactionAction.setFact(fact);
|
||||
businessTransactionAction.setEventNumber(ii++);
|
||||
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.UPDATED_NEWVALUE)){
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.UPDATED_NEWVALUE)) {
|
||||
businessTransactionAction.setEventType(EventType.UPDATEFACTNEWVALUE);
|
||||
businessTransactionAction.setFact(fact);
|
||||
businessTransactionAction.setEventNumber(ii++);
|
||||
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
||||
}else if (fact.getFactType().equals(FactType.UPDATED_OLDVALUE)){
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.UPDATED_OLDVALUE)) {
|
||||
businessTransactionAction.setEventType(EventType.UPDATEFACTOLDVALUE);
|
||||
businessTransactionAction.setFact(fact);
|
||||
businessTransactionAction.setEventNumber(ii++);
|
||||
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
||||
}else if (fact.getFactType().equals(FactType.DELETED)){
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
} else if (fact.getFactType().equals(FactType.DELETED)) {
|
||||
businessTransactionAction.setEventType(EventType.RETRACTFACT);
|
||||
businessTransactionAction.setFact(fact);
|
||||
businessTransactionAction.setEventNumber(ii++);
|
||||
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
||||
actions.put(businessTransactionAction.getEventNumber(), businessTransactionAction);
|
||||
}
|
||||
}
|
||||
for (ProcessExecution processExecution : sessionExecution.getProcessExecutions()){
|
||||
for (ProcessExecution processExecution : sessionExecution.getProcessExecutions()) {
|
||||
BusinessTransactionAction businessTransactionActionStart = new BusinessTransactionAction();
|
||||
|
||||
businessTransactionActionStart.setEventType(EventType.STARTPROCESS);
|
||||
|
|
@ -104,8 +105,8 @@ public class StoreLoggingService {
|
|||
businessTransactionActionStart.setBusinessTransactionId(item.getId());
|
||||
businessTransactionActionStart.setEventNumber(ii++);
|
||||
businessTransactionActionStart.setId(UUID.randomUUID().toString());
|
||||
actions.put(businessTransactionActionStart.getEventNumber(),businessTransactionActionStart);
|
||||
for (RuleflowGroup rfg : processExecution.getRuleflowGroups()){
|
||||
actions.put(businessTransactionActionStart.getEventNumber(), businessTransactionActionStart);
|
||||
for (RuleflowGroup rfg : processExecution.getRuleflowGroups()) {
|
||||
BusinessTransactionAction businessTransactionActionStartRFG = new BusinessTransactionAction();
|
||||
|
||||
businessTransactionActionStartRFG.setBusinessTransactionId(item.getId());
|
||||
|
|
@ -113,8 +114,8 @@ public class StoreLoggingService {
|
|||
businessTransactionActionStartRFG.setRuleflowGroupName(rfg.getRuleflowGroup());
|
||||
businessTransactionActionStartRFG.setEventNumber(ii++);
|
||||
businessTransactionActionStartRFG.setId(UUID.randomUUID().toString());
|
||||
actions.put(businessTransactionActionStartRFG.getEventNumber(),businessTransactionActionStartRFG);
|
||||
for (RuleExecution ruleExecution : rfg.getRuleExecutionList()){
|
||||
actions.put(businessTransactionActionStartRFG.getEventNumber(), businessTransactionActionStartRFG);
|
||||
for (RuleExecution ruleExecution : rfg.getRuleExecutionList()) {
|
||||
BusinessTransactionAction businessTransactionActionRule = new BusinessTransactionAction();
|
||||
|
||||
businessTransactionActionRule.setEventType(EventType.RULE);
|
||||
|
|
@ -124,7 +125,7 @@ public class StoreLoggingService {
|
|||
businessTransactionActionRule.setProcessID(processExecution.getProcessId());
|
||||
businessTransactionActionRule.setEventNumber(ii++);
|
||||
businessTransactionActionRule.setId(UUID.randomUUID().toString());
|
||||
actions.put(businessTransactionActionRule.getEventNumber(),businessTransactionActionRule);
|
||||
actions.put(businessTransactionActionRule.getEventNumber(), businessTransactionActionRule);
|
||||
}
|
||||
BusinessTransactionAction businessTransactionActionSTOPRFG = new BusinessTransactionAction();
|
||||
|
||||
|
|
@ -133,7 +134,7 @@ public class StoreLoggingService {
|
|||
businessTransactionActionSTOPRFG.setBusinessTransactionId(item.getId());
|
||||
businessTransactionActionSTOPRFG.setEventNumber(ii++);
|
||||
businessTransactionActionSTOPRFG.setId(UUID.randomUUID().toString());
|
||||
actions.put(businessTransactionActionSTOPRFG.getEventNumber(),businessTransactionActionSTOPRFG);
|
||||
actions.put(businessTransactionActionSTOPRFG.getEventNumber(), businessTransactionActionSTOPRFG);
|
||||
}
|
||||
BusinessTransactionAction businessTransactionActionEnd = new BusinessTransactionAction();
|
||||
businessTransactionActionEnd.setEventType(EventType.STOPPROCESS);
|
||||
|
|
@ -142,24 +143,22 @@ public class StoreLoggingService {
|
|||
businessTransactionActionEnd.setEventNumber(ii++);
|
||||
businessTransactionActionEnd.setId(UUID.randomUUID().toString());
|
||||
|
||||
actions.put(businessTransactionActionEnd.getEventNumber(),businessTransactionActionEnd);
|
||||
actions.put(businessTransactionActionEnd.getEventNumber(), businessTransactionActionEnd);
|
||||
}
|
||||
if (businessTransactionoutput!= null) {
|
||||
if (businessTransactionoutput != null) {
|
||||
businessTransactionoutput.setEventNumber(ii++);
|
||||
actions.put(businessTransactionoutput.getEventNumber(), businessTransactionoutput);
|
||||
}
|
||||
List<Long> keys = new ArrayList<Long>(actions.keySet());
|
||||
Collections.sort(keys);
|
||||
List<BusinessTransactionAction> sortedList= new LinkedList<>();
|
||||
for (Long i : keys){
|
||||
List<BusinessTransactionAction> sortedList = new LinkedList<>();
|
||||
for (Long i : keys) {
|
||||
sortedList.add(actions.get(i));
|
||||
}
|
||||
transactionRepository.save(item);
|
||||
Iterable<BusinessTransactionAction> toto = actionRepository.saveAll(sortedList);
|
||||
System.out.println("");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
//item.setContent(fileContent);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
spring.data.elasticsearch.cluster-nodes=localhost:9300
|
||||
kafka.bootstrapAddress=localhost:9092,localhost:9093,localhost:9094
|
||||
|
||||
kieserver.login=kieserver
|
||||
kieserver.password=kieserver1
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@
|
|||
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.23.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie:kie-api:7.23.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.23.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-elasticsearch:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-elasticsearch:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-elasticsearch:3.1.11.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.10.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.10.RELEASE" level="project" />
|
||||
|
|
|
|||
|
|
@ -109,62 +109,22 @@
|
|||
<artifactId>camel-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>9.0.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kie</groupId>
|
||||
<artifactId>kie-api</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kie</groupId>
|
||||
<artifactId>kie-internal</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.drools</groupId>
|
||||
<artifactId>drools-compiler</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
<version>${kafka.version}</version>
|
||||
</dependency>
|
||||
<!-- kie-server -->
|
||||
<dependency>
|
||||
<groupId>org.kie.server</groupId>
|
||||
<artifactId>kie-server-api</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.optaplanner</groupId>
|
||||
<artifactId>optaplanner-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.optaplanner</groupId>
|
||||
<artifactId>optaplanner-persistence-xstream</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.optaplanner</groupId>
|
||||
<artifactId>optaplanner-persistence-jaxb</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kie.server</groupId>
|
||||
<artifactId>kie-server-services-common</artifactId>
|
||||
<version>${jbpm.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||
<artifactId>drools-framework-kie-server-services-drools</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<!--exclusion>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
</exclusion>
|
||||
</exclusion-->
|
||||
<exclusion>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-jms-client</artifactId>
|
||||
|
|
@ -213,6 +173,18 @@
|
|||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-resolver</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.optaplanner</groupId>
|
||||
<artifactId>optaplanner-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.optaplanner</groupId>
|
||||
<artifactId>optaplanner-persistence-xstream</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.optaplanner</groupId>
|
||||
<artifactId>optaplanner-persistence-jaxb</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
|||
|
|
@ -16,19 +16,80 @@
|
|||
*/
|
||||
package org.chtijbug.drools.proxy;
|
||||
|
||||
import org.apache.kafka.clients.admin.AdminClientConfig;
|
||||
import org.apache.kafka.clients.admin.NewTopic;
|
||||
import org.apache.kafka.clients.producer.ProducerConfig;
|
||||
import org.apache.kafka.common.serialization.StringSerializer;
|
||||
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.kafka.annotation.EnableKafka;
|
||||
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
|
||||
import org.springframework.kafka.core.KafkaAdmin;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.kafka.core.ProducerFactory;
|
||||
import org.springframework.kafka.support.serializer.JsonSerializer;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
// CHECKSTYLE:OFF
|
||||
@SpringBootApplication
|
||||
@Configuration
|
||||
@EnableKafka
|
||||
public class DroolsBusinessProxyServer {
|
||||
|
||||
|
||||
|
||||
|
||||
@Value(value = "${kafka.bootstrapAddress}")
|
||||
private String bootstrapAddress;
|
||||
|
||||
@Bean
|
||||
public KafkaAdmin kafkaAdmin() {
|
||||
Map<String, Object> configs = new HashMap<>();
|
||||
configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
||||
return new KafkaAdmin(configs);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NewTopic loggingTopic() {
|
||||
return new NewTopic(KafkaTopicConstants.LOGING_TOPIC, 1, (short) 1);
|
||||
}
|
||||
@Bean
|
||||
public NewTopic actionResponseTopic() {
|
||||
return new NewTopic(KafkaTopicConstants.RESPONSE_TOPIC, 1, (short) 1);
|
||||
}
|
||||
@Bean
|
||||
public ProducerFactory<String, ChtijbugObjectRequest> producerFactory() {
|
||||
Map<String, Object> configProps = new HashMap<>();
|
||||
configProps.put(
|
||||
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
|
||||
bootstrapAddress);
|
||||
configProps.put(
|
||||
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
|
||||
StringSerializer.class);
|
||||
configProps.put(
|
||||
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
|
||||
JsonSerializer.class);
|
||||
return new DefaultKafkaProducerFactory<>(configProps);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public KafkaTemplate<String, ChtijbugObjectRequest> kafkaTemplate() {
|
||||
return new KafkaTemplate<>(producerFactory());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Main method to start the application.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,38 +1,43 @@
|
|||
package org.chtijbug.drools.proxy.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.chtijbug.drools.ChtijbugObjectRequest;
|
||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
|
||||
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
|
||||
import org.chtijbug.drools.logging.SessionExecution;
|
||||
import org.chtijbug.kieserver.services.drools.ChtijbugObjectRequest;
|
||||
import org.kie.server.services.api.KieContainerInstance;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoField;
|
||||
import java.util.Set;
|
||||
|
||||
@Service("ruleService")
|
||||
public class RuleService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(RuleService.class);
|
||||
private ObjectMapper mapper = new ObjectMapper();
|
||||
@Inject
|
||||
private KieServiceCommon kieServiceCommon;
|
||||
|
||||
@Inject
|
||||
private KafkaTemplate<String, ChtijbugObjectRequest> kafkaTemplateLogging;
|
||||
|
||||
public RuleService() {
|
||||
System.out.println("rulestep01");
|
||||
logger.info("Rule Service created");
|
||||
}
|
||||
|
||||
public Object runSessionObject(String transactionID, String id, String processID, Object input) throws IOException {
|
||||
KieContainerInstance kci = kieServiceCommon.getRegistry().getContainer(id);
|
||||
public Object runSessionObject(String transactionID, String id, String processID, Object input) {
|
||||
|
||||
ChtijbugObjectRequest chtijbugObjectRequest = new ChtijbugObjectRequest();
|
||||
chtijbugObjectRequest.setTransactionID(transactionID);
|
||||
chtijbugObjectRequest.setProcessID(processID);
|
||||
chtijbugObjectRequest.setContainerID(id);
|
||||
chtijbugObjectRequest.setTransactionStartTimeStamp(LocalDateTime.now());
|
||||
KieContainerInstance kci = kieServiceCommon.getRegistry().getContainer(id);
|
||||
chtijbugObjectRequest.setArtifactID(kci.getKieContainer().getReleaseId().getArtifactId());
|
||||
chtijbugObjectRequest.setGroupID(kci.getKieContainer().getReleaseId().getGroupId());
|
||||
chtijbugObjectRequest.setVersion(kci.getKieContainer().getReleaseId().getVersion());
|
||||
chtijbugObjectRequest.setObjectRequest(input);
|
||||
KieServerAddOnElement kieServerAddOnElement = kieServiceCommon.getDroolsChtijbugRulesExecutionService().getKieServerAddOnElement();
|
||||
if (kieServerAddOnElement != null) {
|
||||
|
|
@ -44,53 +49,15 @@ public class RuleService {
|
|||
/**
|
||||
* remove facts from logging to avoid infinite loop when marshalling to json and size of logging
|
||||
*/
|
||||
SessionExecution sessionExecution = chtijbutObjectResponse.getSessionLogging().getSessionExecution();
|
||||
if (kieServerAddOnElement != null) {
|
||||
|
||||
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
|
||||
kieServerLoggingDefinition.OnFireAllrulesEnd(kci.getKieContainer().getReleaseId().getGroupId(), kci.getKieContainer().getReleaseId().getArtifactId(), kci.getKieContainer().getReleaseId().getVersion(), chtijbutObjectResponse.getObjectRequest(), chtijbutObjectResponse.getSessionLogging());
|
||||
}
|
||||
}
|
||||
String jsonInString = null;
|
||||
|
||||
String fileTemp = System.getProperty("org.chtijbug.server.tracedir");
|
||||
if (fileTemp != null) {
|
||||
if (jsonInString == null) {
|
||||
jsonInString = mapper.writeValueAsString(chtijbutObjectResponse.getSessionLogging());
|
||||
}
|
||||
String fileUUID = null;
|
||||
if (transactionID == null) {
|
||||
fileUUID = "noTransactionID";
|
||||
} else {
|
||||
fileUUID = transactionID;
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
int year = now.getYear();
|
||||
int month = now.getMonthValue();
|
||||
int day = now.getDayOfMonth();
|
||||
int hour = now.getHour();
|
||||
int minute = now.getMinute();
|
||||
int second = now.getSecond();
|
||||
int millis = now.get(ChronoField.MILLI_OF_SECOND);
|
||||
String fileName = year + "-" + month + "-" + day + "-" + hour + "-" + minute + "-" + second + "-" + millis + "-" + fileUUID.replaceAll("-", "") + ".json";
|
||||
File traceFile = new File(fileTemp + "/" + fileName);
|
||||
FileUtils.writeByteArrayToFile(traceFile, jsonInString.getBytes());
|
||||
chtijbugObjectRequest.setTransactionEndTimeStamp(LocalDateTime.now());
|
||||
kafkaTemplateLogging.send(KafkaTopicConstants.LOGING_TOPIC,chtijbugObjectRequest);
|
||||
return chtijbutObjectResponse.getObjectRequest();
|
||||
}
|
||||
|
||||
Object response = chtijbutObjectResponse.getObjectRequest();
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
private Class getClassFromName(Set<Class<?>> classes, String name) {
|
||||
Class result = null;
|
||||
for (Class c : classes) {
|
||||
if (c.getCanonicalName() != null
|
||||
&& c.getCanonicalName().equals(name)) {
|
||||
result = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,3 +25,4 @@ spring.data.mongodb.host=localhost:28017
|
|||
|
||||
eureka.client.service-url.defaultZone=http://127.0.0.1:8761/eureka/
|
||||
spring.application.name=proxy-app-${org.kie.server.id}
|
||||
kafka.bootstrapAddress=localhost:9092,localhost:9093,localhost:9094
|
||||
|
|
@ -26,79 +26,76 @@
|
|||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="drools-framework-business-proxy-persistence" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-mongodb:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver:3.8.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.8.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.8.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-mongodb:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-mongodb:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver:3.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:bson:3.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-mongodb:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.10.3" level="project" />
|
||||
<orderEntry type="module" module-name="drools-framework-runtime-entity" />
|
||||
<orderEntry type="module" module-name="drools-framework-common" />
|
||||
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest:2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.10.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie:kie-internal:7.38.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie:kie-api:7.38.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.38.0.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.kafka:spring-kafka:2.3.7.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:2.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.luben:zstd-jni:1.4.0-1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.lz4:lz4-java:1.6.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.xerial.snappy:snappy-java:1.1.7.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.mkopylec:charon-spring-boot-starter:3.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.12" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.13.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-spring-boot-starter:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-spring-boot:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-spring:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-core-starter:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-quartz2:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.camel:camel-core:2.23.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.quartz-scheduler:quartz:2.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.5.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-core:2.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.12.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.12.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.10.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.10.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.10.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.33" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.33" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.33" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.2.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.2.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.1.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.1.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.2.6.RELEASE" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -17,6 +17,11 @@
|
|||
<artifactId>drools-framework-business-proxy-persistence</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
<version>${kafka.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.mkopylec</groupId>
|
||||
<artifactId>charon-spring-boot-starter</artifactId>
|
||||
|
|
@ -27,15 +32,9 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-quartz2</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,45 @@
|
|||
package org.chtijbug.drools.reverseproxy;
|
||||
|
||||
|
||||
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||
import org.apache.kafka.common.serialization.StringDeserializer;
|
||||
import org.chtijbug.drools.ReverseProxyUpdate;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
|
||||
import org.springframework.kafka.core.ConsumerFactory;
|
||||
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
|
||||
import org.springframework.kafka.support.serializer.JsonDeserializer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableMongoRepositories(basePackages = "org.chtijbug.drools.proxy.persistence.repository")
|
||||
public class DroolsBusinessReverseProxyServer {
|
||||
|
||||
@Value(value = "${kafka.bootstrapAddress}")
|
||||
private String bootstrapAddress;
|
||||
|
||||
public ConsumerFactory<String, ReverseProxyUpdate> mappingConsumerFactory() {
|
||||
Map<String, Object> props = new HashMap<>();
|
||||
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapAddress);
|
||||
props.put(ConsumerConfig.GROUP_ID_CONFIG, "greeting");
|
||||
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(ReverseProxyUpdate.class));
|
||||
}
|
||||
@Bean
|
||||
public ConcurrentKafkaListenerContainerFactory<String, ReverseProxyUpdate>
|
||||
mappingKafkaListenerContainerFactory() {
|
||||
|
||||
ConcurrentKafkaListenerContainerFactory<String, ReverseProxyUpdate> factory =
|
||||
new ConcurrentKafkaListenerContainerFactory<>();
|
||||
factory.setConsumerFactory(mappingConsumerFactory());
|
||||
return factory;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DroolsBusinessReverseProxyServer.class, args);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
package org.chtijbug.drools.reverseproxy.camel;
|
||||
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class AutodeployRouter extends RouteBuilder {
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
from("quartz2://myGroup/myTimerName?cron=0/10+*+*+?+*+*").to("bean:updateService?method=updateConfig()");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package org.chtijbug.drools.reverseproxy.service;
|
||||
|
||||
import com.github.mkopylec.charon.configuration.MappingProperties;
|
||||
import org.chtijbug.drools.ReverseProxyUpdate;
|
||||
import org.chtijbug.drools.common.KafkaTopicConstants;
|
||||
import org.chtijbug.drools.proxy.persistence.model.ProjectPersist;
|
||||
import org.chtijbug.drools.proxy.persistence.model.RuntimePersist;
|
||||
import org.chtijbug.drools.proxy.persistence.repository.ProjectRepository;
|
||||
|
|
@ -9,6 +11,7 @@ import org.chtijbug.drools.reverseproxy.mappings.CustomMappingsProvider;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.kafka.annotation.KafkaListener;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
|
@ -28,9 +31,10 @@ public class UpdateService {
|
|||
|
||||
private Boolean toUpdate = true;
|
||||
|
||||
private List<MappingProperties> mappings=new ArrayList<>();
|
||||
private List<MappingProperties> mappings = new ArrayList<>();
|
||||
|
||||
private Map<String, MappingProperties> mappingPropertiesMap = new HashMap<>();
|
||||
|
||||
private Map<String,MappingProperties> mappingPropertiesMap = new HashMap<>();
|
||||
@Autowired
|
||||
private CustomMappingsProvider customMappingsProvider;
|
||||
|
||||
|
|
@ -38,69 +42,41 @@ public class UpdateService {
|
|||
return toUpdate;
|
||||
}
|
||||
|
||||
public void updateConfig() {
|
||||
/**
|
||||
if (this.toUpdate==false) {
|
||||
this.toUpdate = isToUpdate();
|
||||
if (this.toUpdate==true){
|
||||
generateMappings();
|
||||
}
|
||||
}
|
||||
**/
|
||||
generateMappings();
|
||||
}
|
||||
|
||||
private boolean isToUpdate() {
|
||||
boolean result = false;
|
||||
runtimes.clear();
|
||||
List<RuntimePersist> runtimePersists = runtimeRepository.findAll();
|
||||
Map<String, String> urlMap = new HashMap<>();
|
||||
for (RuntimePersist runtimePersist : runtimePersists) {
|
||||
if (urlMap.containsKey(runtimePersist.getServerName()) == false) {
|
||||
urlMap.put(runtimePersist.getServerName(), runtimePersist.getServerUrl());
|
||||
runtimes.put(runtimePersist.getServerName(), runtimePersist.duplicate());
|
||||
@KafkaListener(
|
||||
topics = KafkaTopicConstants.REVERSE_PROXY,
|
||||
containerFactory = "mappingKafkaListenerContainerFactory")
|
||||
public void store(ReverseProxyUpdate update) {
|
||||
boolean found = false;
|
||||
for (MappingProperties mappingProperties : mappingPropertiesMap.values()) {
|
||||
if (mappingProperties.getPath().equals(update.getPath())) {
|
||||
found = true;
|
||||
mappingProperties.getDestinations().clear();
|
||||
for (String destination : update.getServerNames()) {
|
||||
mappingProperties.getDestinations().add(destination);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<ProjectPersist> projectPersists = projectRepository.findAll();
|
||||
List<String> projectOk = new ArrayList<>();
|
||||
for (ProjectPersist projectPersist : projectPersists) {
|
||||
if (projectPersist.getServerNames().size() > 0) {
|
||||
projectOk.add(projectPersist.getContainerID());
|
||||
if (projects.containsKey(projectPersist.getContainerID()) == false) {
|
||||
return true;
|
||||
if (!found) {
|
||||
MappingProperties newMappingProperties = new MappingProperties();
|
||||
newMappingProperties.setPath(update.getPath());
|
||||
for (String destination : update.getServerNames()) {
|
||||
newMappingProperties.getDestinations().add(destination);
|
||||
}
|
||||
|
||||
// if a new project is not in the already displayed
|
||||
|
||||
List<String> list1 = projectPersist.getServerNames();
|
||||
int l1 = list1.size();
|
||||
ProjectPersist run2 = projects.get(projectPersist.getContainerID());
|
||||
List<String> list2 = run2.getServerNames();
|
||||
if (list2.size() != list1.size()) {
|
||||
return true;
|
||||
mappingPropertiesMap.put(update.getPath(), newMappingProperties);
|
||||
}
|
||||
list1.retainAll(list2);
|
||||
if (list2.size() != list1.size()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// An existing project in the reverse is no more to be displayed
|
||||
for (String goodId : projects.keySet()) {
|
||||
if (projectOk.contains(goodId) == false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
mappings.clear();
|
||||
mappings.addAll(mappingPropertiesMap.values());
|
||||
this.toUpdate = true;
|
||||
}
|
||||
|
||||
public List<MappingProperties> retrievePath() {
|
||||
this.toUpdate=false;
|
||||
this.toUpdate = false;
|
||||
return mappings;
|
||||
}
|
||||
private void generateMappings(){
|
||||
|
||||
private void generateMappings() {
|
||||
projects.clear();
|
||||
mappingPropertiesMap.clear();
|
||||
List<MappingProperties> paths = new ArrayList<>();
|
||||
|
|
@ -117,16 +93,16 @@ public class UpdateService {
|
|||
if (projectPersist.getServerNames().size() > 0) {
|
||||
projects.put(projectPersist.getContainerID(), projectPersist.duplicate());
|
||||
MappingProperties mappingProperties2 = new MappingProperties();
|
||||
String servList=null;
|
||||
String servList = null;
|
||||
for (String serverName : projectPersist.getServerNames()) {
|
||||
RuntimePersist runtimePersist = runtimes.get(serverName);
|
||||
if (runtimePersist!= null) {
|
||||
if (runtimePersist != null) {
|
||||
String hostName = runtimePersist.getServerUrl() + "/api/" + projectPersist.getContainerID();
|
||||
mappingProperties2.getDestinations().add(hostName);
|
||||
if (servList==null){
|
||||
servList=serverName;
|
||||
}else{
|
||||
servList=servList+":"+serverName;
|
||||
if (servList == null) {
|
||||
servList = serverName;
|
||||
} else {
|
||||
servList = servList + ":" + serverName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -136,13 +112,13 @@ public class UpdateService {
|
|||
mappingProperties2.getCustomConfiguration().put("connect", 2000);
|
||||
mappingProperties2.getCustomConfiguration().put("read", 2000);
|
||||
mappingProperties2.setStripPath(true);
|
||||
if ( mappingProperties2.getDestinations().size()>0) {
|
||||
mappingPropertiesMap.put(mappingProperties2.getPath(),mappingProperties2);
|
||||
if (mappingProperties2.getDestinations().size() > 0) {
|
||||
mappingPropertiesMap.put(mappingProperties2.getPath(), mappingProperties2);
|
||||
paths.add(mappingProperties2);
|
||||
logger.info("Project "+projectPersist.getContainerID()+" defined on servers - "+mappingProperties2.getDestinations().toString());
|
||||
logger.info("Project " + projectPersist.getContainerID() + " defined on servers - " + mappingProperties2.getDestinations().toString());
|
||||
|
||||
}else{
|
||||
logger.error("Project "+projectPersist.getContainerID()+" defined on non existing server");
|
||||
} else {
|
||||
logger.error("Project " + projectPersist.getContainerID() + " defined on non existing server");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,3 +2,4 @@ server.port=9500
|
|||
spring.data.mongodb.database=businessProxyDB
|
||||
spring.data.mongodb.host=localhost:28017
|
||||
charon.tracing.enabled=true
|
||||
kafka.bootstrapAddress=localhost:9092,localhost:9093,localhost:9094
|
||||
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
<properties>
|
||||
<category>Rest</category>
|
||||
<spring.boot-version>2.1.0.RELEASE</spring.boot-version>
|
||||
<camel.version>2.23.0</camel.version>
|
||||
<spring.boot-version>${spring.boot.version}</spring.boot-version>
|
||||
<camel.version>2.25.1</camel.version>
|
||||
</properties>
|
||||
<modules>
|
||||
<module>drools-framework-business-proxy-app</module>
|
||||
|
|
|
|||
6
pom.xml
6
pom.xml
|
|
@ -21,9 +21,9 @@
|
|||
<node.version>v10.16.3</node.version>
|
||||
<npm.version>6.11.3</npm.version>
|
||||
<frontend-maven-plugin.version>1.8.0</frontend-maven-plugin.version>
|
||||
<spring.boot.version>2.1.2.RELEASE</spring.boot.version>
|
||||
<spring.boot.version>2.2.6.RELEASE</spring.boot.version>
|
||||
|
||||
<spring.version>4.3.16.RELEASE</spring.version>
|
||||
<spring.version>5.2.6.RELEASE</spring.version>
|
||||
<version.thorntail>2.2.1.Final</version.thorntail>
|
||||
<!--registry.host>registry.hub.docker.com/pymmasoftware</registry.host-->
|
||||
<registry.host>192.168.1.122:18083</registry.host>
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
<version.org.wildfly.core>4.0.0.Final</version.org.wildfly.core>
|
||||
<version.mongodb.driver>3.8.2</version.mongodb.driver>
|
||||
<version.number>${git.commit.time}.${git.commit.id.abbrev}</version.number>
|
||||
|
||||
<kafka.version>2.3.7.RELEASE</kafka.version>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue