Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make source message generator into separate process #22

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion core/docker-compose.fakeuds.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.2'
services:
fakeuds:
image: postgres:11-alpine
Expand Down
14 changes: 11 additions & 3 deletions core/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.2'
services:
core:
build:
Expand All @@ -15,8 +14,10 @@ services:
driver: "json-file"
restart: on-failure
depends_on:
- glowroot-central
- rabbitmq
glowroot-central:
condition: service_started
rabbitmq:
condition: service_healthy
rabbitmq:
image: rabbitmq:management
env_file:
Expand All @@ -25,6 +26,13 @@ services:
- "${RABBITMQ_PORT}:5672"
- "${RABBITMQ_ADMIN_PORT}:15672"
restart: on-failure
healthcheck:
# rabbitmq server crashes if any rabbitmq-diagnostics cmd is run very soon
# after starting, so can't check too aggressively here
test: rabbitmq-diagnostics -q check_running
interval: 30s
timeout: 10s
retries: 3
cassandra:
image: cassandra
restart: on-failure
Expand Down
1 change: 1 addition & 0 deletions emap-setup/emap_runner/docker/docker_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def docker_compose_paths(self) -> List[Path]:
Path(self.emap_dir, "core", "docker-compose.fakeuds.yml"),
Path(self.emap_dir, "hl7-reader", "docker-compose.yml"),
Path(self.emap_dir, "waveform-reader", "docker-compose.yml"),
Path(self.emap_dir, "waveform-generator", "docker-compose.yml"),
]
# allow for hoover and to be optional compose path
if "hoover" in self.config["repositories"]:
Expand Down
1 change: 0 additions & 1 deletion hl7-reader/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.2'
services:
hl7-reader:
build:
Expand Down
24 changes: 24 additions & 0 deletions waveform-generator/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"transactions": {
"slowThresholdMillis": 300,
"profilingIntervalMillis": 1000,
"captureThreadStats": true
},
"instrumentation": [
{
"className": "uk.ac.ucl.rits.inform.datasources.waveform_generator.Hl7Generator",
"methodName": "generateMessages",
"methodParameterTypes": [
".."
],
"captureKind": "transaction",
"transactionType": "Web",
"transactionNameTemplate": "mainLoop",
"transactionSlowThresholdMillis": 500,
"alreadyInTransactionBehavior": "capture-new-transaction",
"traceEntryMessageTemplate": "{{this}}.{{methodName}}({{0}}, {{1}}, {{2}})",
"timerName": "mainLoop"
}
]
}

19 changes: 19 additions & 0 deletions waveform-generator/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
waveform-generator:
build:
context: ..
dockerfile: waveform-reader/Dockerfile
target: waveform_generator
args:
HTTP_PROXY: ${HTTP_PROXY}
http_proxy: ${http_proxy}
HTTPS_PROXY: ${HTTPS_PROXY}
https_proxy: ${https_proxy}
SERVICE_SRC_DIR: waveform-generator
env_file:
- ../../config/waveform-reader-config-envs
logging:
driver: "json-file"
restart: "no"
depends_on:
- waveform-reader
2 changes: 2 additions & 0 deletions waveform-generator/glowroot.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
agent.id=waveform-generator
collector.address=http://glowroot-central:8181
143 changes: 143 additions & 0 deletions waveform-generator/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>uk.ac.ucl.rits.inform</groupId>
<artifactId>waveform-generator</artifactId>
<packaging>jar</packaging>
<version>2.7</version>
<name>Waveform Synthetic Generator</name>
<description>Service to generate synthetic HL7 messages and send them to the generator as a test</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot.version>2.6.3</spring-boot.version>
<java.version>17</java.version>
<checkstyle.version>10.3.1</checkstyle.version>
<checkstyle.plugin.version>3.3.0</checkstyle.plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<com.google.code.findbugs.annotations.version>3.0.1u2</com.google.code.findbugs.annotations.version>
<spring.boot.mainclass>uk.ac.ucl.rits.inform.datasources.waveform_generator.Application</spring.boot.mainclass>
<validation-api.version>2.0.1.Final</validation-api.version>
<liquibase-hibernate5.version>4.7.1</liquibase-hibernate5.version>
<javassist.version>3.28.0-GA</javassist.version>
<go-offline-maven-plugin.version>1.2.8</go-offline-maven-plugin.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>

<!-- get rid of warning about maybe enum when using @Nullable -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>${com.google.code.findbugs.annotations.version}</version>
</dependency>

<!-- Add configuration of spring boot properties -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>


</dependencies>
<build>
<finalName>waveform-generator</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

<plugin>
<!-- Checkstyle plugin -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.plugin.version}</version>
<configuration>
<configLocation>../emap-checker.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- plugin to download dependencies, mvn dependencies:go-offline doesn't exclude artifacts/groups correctly -->
<plugin>
<groupId>de.qaware.maven</groupId>
<artifactId>go-offline-maven-plugin</artifactId>
<version>${go-offline-maven-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<release>${java.version}</release>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
</plugins>
</reporting>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package uk.ac.ucl.rits.inform.datasources.waveform_generator;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
* Spring application entry point.
* @author Jeremy Stein
*/
@SpringBootApplication(scanBasePackages = {
"uk.ac.ucl.rits.inform.datasources.waveform_generator",
})
@EnableScheduling
public class Application {
private final Logger logger = LoggerFactory.getLogger(Application.class);

/**
* @param args command line args
*/
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}



}
Loading