integrate Apache Camel into Spring Boot
This commit is contained in:
@@ -54,9 +54,13 @@ configurations {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.vaadin:vaadin-core'
|
implementation 'com.vaadin:vaadin-core'
|
||||||
implementation 'com.vaadin:vaadin-spring-boot-starter'
|
implementation 'com.vaadin:vaadin-spring-boot-starter'
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-artemis'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||||
|
implementation 'org.apache.camel.springboot:camel-spring-boot-starter'
|
||||||
|
implementation 'org.apache.activemq:artemis-jakarta-client'
|
||||||
|
implementation 'org.apache.camel.springboot:camel-jms-starter'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
||||||
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
||||||
implementation 'io.micrometer:micrometer-registry-prometheus'
|
implementation 'io.micrometer:micrometer-registry-prometheus'
|
||||||
@@ -78,6 +82,7 @@ dependencies {
|
|||||||
testImplementation 'org.springframework.security:spring-security-test'
|
testImplementation 'org.springframework.security:spring-security-test'
|
||||||
testImplementation 'com.vaadin:vaadin-testbench-junit5'
|
testImplementation 'com.vaadin:vaadin-testbench-junit5'
|
||||||
testImplementation 'io.projectreactor:reactor-test'
|
testImplementation 'io.projectreactor:reactor-test'
|
||||||
|
testImplementation 'org.apache.camel:camel-test-spring-junit5'
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
compileOnly 'org.projectlombok:lombok'
|
compileOnly 'org.projectlombok:lombok'
|
||||||
annotationProcessor 'org.projectlombok:lombok'
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
@@ -145,6 +150,7 @@ build.dependsOn asciidoctorPdf
|
|||||||
dependencyManagement {
|
dependencyManagement {
|
||||||
imports {
|
imports {
|
||||||
mavenBom libs.vaadin.bom.get().toString()
|
mavenBom libs.vaadin.bom.get().toString()
|
||||||
|
mavenBom libs.camel.bom.get().toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ cimtConventions = "1.0.0-SNAPSHOT"
|
|||||||
springboot = "3.2.5"
|
springboot = "3.2.5"
|
||||||
springdependencies = "1.1.4"
|
springdependencies = "1.1.4"
|
||||||
vaadin = "24.3.8"
|
vaadin = "24.3.8"
|
||||||
|
camel = "4.10.6"
|
||||||
lombok = "8.6"
|
lombok = "8.6"
|
||||||
gson = "2.9.0"
|
gson = "2.9.0"
|
||||||
jackson = "2.16.1"
|
jackson = "2.16.1"
|
||||||
@@ -43,6 +44,7 @@ mail = { module = "com.sun.mail:javax.mail", version.ref ="mail" }
|
|||||||
sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version.ref = "sqlite" }
|
sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version.ref = "sqlite" }
|
||||||
hypersistence = { module = "io.hypersistence:hypersistence-utils-hibernate-63", version.ref = "hypersistence" }
|
hypersistence = { module = "io.hypersistence:hypersistence-utils-hibernate-63", version.ref = "hypersistence" }
|
||||||
vaadin-bom = { module = "com.vaadin:vaadin-bom", version.ref = "vaadin" }
|
vaadin-bom = { module = "com.vaadin:vaadin-bom", version.ref = "vaadin" }
|
||||||
|
camel-bom = { module = "org.apache.camel.springboot:camel-spring-boot-bom", version.ref = "camel"}
|
||||||
asciidoctorGradleJvmGems = { module = "org.asciidoctor:asciidoctor-gradle-jvm-gems", version.ref= "asciidoctor" }
|
asciidoctorGradleJvmGems = { module = "org.asciidoctor:asciidoctor-gradle-jvm-gems", version.ref= "asciidoctor" }
|
||||||
asciidoctorGradleJvm = { module = "org.asciidoctor:asciidoctor-gradle-jvm", version.ref= "asciidoctor" }
|
asciidoctorGradleJvm = { module = "org.asciidoctor:asciidoctor-gradle-jvm", version.ref= "asciidoctor" }
|
||||||
asciidoctorGradleJvmPdf = { module = "org.asciidoctor:asciidoctor-gradle-jvm-pdf", version.ref= "asciidoctor" }
|
asciidoctorGradleJvmPdf = { module = "org.asciidoctor:asciidoctor-gradle-jvm-pdf", version.ref= "asciidoctor" }
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package de.thpeetz.kontor.integration;
|
||||||
|
|
||||||
|
import org.apache.camel.builder.RouteBuilder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ReadQueueRoute extends RouteBuilder {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure() throws Exception {
|
||||||
|
from("jms:queue:KontorMediaFile")
|
||||||
|
.log("${body}");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,14 +24,29 @@ spring:
|
|||||||
multipart:
|
multipart:
|
||||||
max-file-size: 10MB
|
max-file-size: 10MB
|
||||||
max-request-size: 10MB
|
max-request-size: 10MB
|
||||||
|
artemis:
|
||||||
|
mode: native
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 61616
|
||||||
|
user: artemis
|
||||||
|
password: artemis
|
||||||
|
camel:
|
||||||
|
cloud:
|
||||||
|
enabled: true
|
||||||
|
springboot:
|
||||||
|
routes-reload-enabled: true
|
||||||
|
routes-reload-directory: routes
|
||||||
|
routes-relaod-pattern: "*.xml"
|
||||||
management:
|
management:
|
||||||
endpoints:
|
endpoints:
|
||||||
web:
|
web:
|
||||||
exposure:
|
exposure:
|
||||||
include: health,info,metrics,prometheus
|
include: health,info,metrics,prometheus,camelroutes
|
||||||
endpoint:
|
endpoint:
|
||||||
health:
|
health:
|
||||||
show-details: always
|
show-details: always
|
||||||
|
probes:
|
||||||
|
enabled: true
|
||||||
prometheus:
|
prometheus:
|
||||||
enabled: true
|
enabled: true
|
||||||
logging:
|
logging:
|
||||||
|
|||||||
@@ -1,11 +1,30 @@
|
|||||||
package de.thpeetz.kontor;
|
package de.thpeetz.kontor;
|
||||||
|
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@SpringBootTest
|
import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
|
||||||
|
import org.apache.camel.CamelContext;
|
||||||
|
import org.apache.camel.builder.NotifyBuilder;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
|
||||||
|
@CamelSpringBootTest
|
||||||
|
@SpringBootTest(classes = Application.class)
|
||||||
class ApplicationTests {
|
class ApplicationTests {
|
||||||
|
@Autowired
|
||||||
|
private CamelContext camelContext;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void shouldProduceMessages() throws Exception {
|
||||||
|
NotifyBuilder notify = new NotifyBuilder(camelContext).whenDone(1).create();
|
||||||
|
assertTrue(notify.matches(10, TimeUnit.SECONDS));
|
||||||
|
}
|
||||||
@Test
|
@Test
|
||||||
void contextLoads() {
|
void contextLoads() {
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -1,5 +1,6 @@
|
|||||||
package de.thpeetz.kontor.media.services;
|
package de.thpeetz.kontor.media.services;
|
||||||
|
|
||||||
|
import de.thpeetz.kontor.common.views.SearchFilter;
|
||||||
import de.thpeetz.kontor.media.TestConstants;
|
import de.thpeetz.kontor.media.TestConstants;
|
||||||
import de.thpeetz.kontor.media.data.MediaFile;
|
import de.thpeetz.kontor.media.data.MediaFile;
|
||||||
import org.junit.jupiter.api.MethodOrderer;
|
import org.junit.jupiter.api.MethodOrderer;
|
||||||
@@ -40,7 +41,9 @@ public class MediaFileServiceTest {
|
|||||||
@Order(3)
|
@Order(3)
|
||||||
void testDeleteMediaFile() {
|
void testDeleteMediaFile() {
|
||||||
int mediaFileCount = mediaFileService.findAllMediaFiles(null).size();
|
int mediaFileCount = mediaFileService.findAllMediaFiles(null).size();
|
||||||
List<MediaFile> mediaFileList = mediaFileService.findAllMediaFiles(TestConstants.URL);
|
SearchFilter searchFilter = new SearchFilter();
|
||||||
|
searchFilter.setSearchTerm(TestConstants.URL);
|
||||||
|
List<MediaFile> mediaFileList = mediaFileService.findAllMediaFiles(searchFilter);
|
||||||
assertEquals(1, mediaFileList.size());
|
assertEquals(1, mediaFileList.size());
|
||||||
mediaFileService.deleteMediaFile(mediaFileList.get(0));
|
mediaFileService.deleteMediaFile(mediaFileList.get(0));
|
||||||
assertEquals(--mediaFileCount, mediaFileService.findAllMediaFiles(null).size());
|
assertEquals(--mediaFileCount, mediaFileService.findAllMediaFiles(null).size());
|
||||||
|
|||||||
Reference in New Issue
Block a user