This commit is contained in:
@@ -14,7 +14,9 @@ ENV PATH="/root/.local/bin:${PATH}"
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./pyproject.toml .
|
||||
RUN --mount=type=bind,source=/home/tpeetz/projects/kontor/kontor-model,target=/container/kontor-model uv add /container/kontor-model
|
||||
#RUN --mount=type=bind,source=/home/tpeetz/projects/kontor/kontor-model,target=/container/kontor-model uv add /container/kontor-model
|
||||
#COPY ../kontor-model/ /container
|
||||
RUN uv add /container/kontor-model
|
||||
RUN uv sync
|
||||
|
||||
# ------------------------------- Production Stage ------------------------------ ##
|
||||
|
||||
+14
-15
@@ -21,22 +21,21 @@ public class QueueMediaLink extends RouteBuilder {
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
from("jms:queue:media.link")
|
||||
.errorHandler(deadLetterChannel("jms:queue:DLQ")
|
||||
.maximumRedeliveries(0)
|
||||
.useOriginalMessage()
|
||||
.onPrepareFailure(exchange -> {
|
||||
exchange.getIn().setHeader("FailureReason", "processing failed");
|
||||
})
|
||||
)
|
||||
.routeId("media.link")
|
||||
.log("${body}")
|
||||
.trace(true)
|
||||
.process(new CheckLinkProcessor(mediaFileService))
|
||||
.choice()
|
||||
.errorHandler(deadLetterChannel("jms:queue:DLQ")
|
||||
.maximumRedeliveries(0)
|
||||
.useOriginalMessage()
|
||||
.onPrepareFailure(exchange -> {
|
||||
exchange.getIn().setHeader("FailureReason", "processing failed");
|
||||
}))
|
||||
.routeId("media.link")
|
||||
.log("${body}")
|
||||
.trace(true)
|
||||
.process(new CheckLinkProcessor(mediaFileService))
|
||||
.choice()
|
||||
.when(exchangeProperty("linkId").isNotNull())
|
||||
.to("jms:queue:media.link.add")
|
||||
.to("jms:queue:media.link.add")
|
||||
.otherwise()
|
||||
.to("jms:queue:DLQ")
|
||||
.to("jms:queue:media.link.add.processed");
|
||||
.to("jms:queue:DLQ")
|
||||
.to("jms:queue:media.link.processed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package de.thpeetz.kontor.integration.routes;
|
||||
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import de.thpeetz.kontor.integration.services.CheckLoFiProcessor;
|
||||
import de.thpeetz.kontor.services.MediaFileService;
|
||||
|
||||
@Component
|
||||
public class QueueMediaLoFi extends RouteBuilder {
|
||||
|
||||
@Autowired
|
||||
private final MediaFileService mediaFileService;
|
||||
|
||||
@Autowired
|
||||
public QueueMediaLoFi(MediaFileService mediaFileService) {
|
||||
this.mediaFileService = mediaFileService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
from("jms:queue:media.lofi")
|
||||
.errorHandler(deadLetterChannel("jms:queue:DLQ")
|
||||
.maximumRedeliveries(0)
|
||||
.useOriginalMessage()
|
||||
.onPrepareFailure(exchange -> {
|
||||
exchange.getIn().setHeader("FailureReason", "processing failed");
|
||||
}))
|
||||
.routeId("media.lofi")
|
||||
.log("${body}")
|
||||
.trace(true)
|
||||
.process(new CheckLoFiProcessor(mediaFileService))
|
||||
.choice()
|
||||
.when(exchangeProperty("linkId").isNotNull())
|
||||
.to("jms:queue:media.lofi.add")
|
||||
.otherwise()
|
||||
.to("jms:queue:DLQ")
|
||||
.to("jms:queue:media.lofi.processed");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package de.thpeetz.kontor.integration.routes;
|
||||
|
||||
import org.apache.camel.builder.RouteBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import de.thpeetz.kontor.integration.services.CheckLoFiProcessor;
|
||||
import de.thpeetz.kontor.services.MediaFileService;
|
||||
|
||||
@Component
|
||||
public class QueueMediaVideo extends RouteBuilder {
|
||||
|
||||
@Autowired
|
||||
private final MediaFileService mediaFileService;
|
||||
|
||||
@Autowired
|
||||
public QueueMediaVideo(MediaFileService mediaFileService) {
|
||||
this.mediaFileService = mediaFileService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() throws Exception {
|
||||
from("jms:queue:media.video")
|
||||
.errorHandler(deadLetterChannel("jms:queue:DLQ")
|
||||
.maximumRedeliveries(0)
|
||||
.useOriginalMessage()
|
||||
.onPrepareFailure(exchange -> {
|
||||
exchange.getIn().setHeader("FailureReason", "processing failed");
|
||||
}))
|
||||
.routeId("media.video")
|
||||
.log("${body}")
|
||||
.trace(true)
|
||||
.process(new CheckLoFiProcessor(mediaFileService))
|
||||
.choice()
|
||||
.when(exchangeProperty("linkId").isNotNull())
|
||||
.to("jms:queue:media.video.add")
|
||||
.otherwise()
|
||||
.to("jms:queue:DLQ")
|
||||
.to("jms:queue:media.video.processed");
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package de.thpeetz.kontor.integration.services;
|
||||
|
||||
import org.apache.camel.Exchange;
|
||||
import org.apache.camel.Processor;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import de.thpeetz.kontor.services.MediaFileService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class CheckLoFiProcessor implements Processor {
|
||||
|
||||
private final MediaFileService mediaFileService;
|
||||
|
||||
public CheckLoFiProcessor(MediaFileService mediaFileService) {
|
||||
this.mediaFileService = mediaFileService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(Exchange exchange) throws Exception {
|
||||
String messageBody = exchange.getIn().getBody(String.class);
|
||||
log.info("message body: {}", messageBody);
|
||||
|
||||
JSONParser parser = new JSONParser();
|
||||
try {
|
||||
JSONObject jsonObject = (JSONObject) parser.parse(messageBody);
|
||||
String url = (String) jsonObject.get("url");
|
||||
log.info("found url: {}", url);
|
||||
exchange.getIn().setHeader("linkId", null);
|
||||
} catch (ParseException pe) {
|
||||
log.info("parse exception: {}", pe.toString());
|
||||
exchange.getIn().setHeader("linkId", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package de.thpeetz.kontor.integration.services;
|
||||
|
||||
import org.apache.camel.Exchange;
|
||||
import org.apache.camel.Processor;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import de.thpeetz.kontor.services.MediaFileService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class CheckVideoProcessor implements Processor {
|
||||
|
||||
private final MediaFileService mediaFileService;
|
||||
|
||||
public CheckVideoProcessor(MediaFileService mediaFileService) {
|
||||
this.mediaFileService = mediaFileService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(Exchange exchange) throws Exception {
|
||||
String messageBody = exchange.getIn().getBody(String.class);
|
||||
log.info("message body: {}", messageBody);
|
||||
|
||||
JSONParser parser = new JSONParser();
|
||||
try {
|
||||
JSONObject jsonObject = (JSONObject) parser.parse(messageBody);
|
||||
String url = (String) jsonObject.get("url");
|
||||
log.info("found url: {}", url);
|
||||
exchange.getIn().setHeader("linkId", null);
|
||||
} catch (ParseException pe) {
|
||||
log.info("parse exception: {}", pe.toString());
|
||||
exchange.getIn().setHeader("linkId", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -9,7 +9,7 @@ cd "$(dirname "$0")/.."
|
||||
echo " => Baue Image localhost/kontor-spring:0.3.0"
|
||||
buildah build -t kontor-spring:0.3.0 kontor-spring
|
||||
echo " => Baue Image localhost/kontor-api:0.3.0"
|
||||
buildah build --volume /home/tpeetz/projects/kontor/kontor-model:/container/kontor-model kontor-api:0.3.0 kontor-api
|
||||
buildah build --volume /home/tpeetz/projects/kontor/kontor-model:/container/kontor-model -t kontor-api:0.3.0 kontor-api
|
||||
echo " => Baue Image localhost/kontor-quarkus:0.3.0"
|
||||
buildah build -t kontor-quarkus:0.3.0 kontor-quarkus
|
||||
echo " => Baue Image localhost/kontor-echo:0.3.0"
|
||||
|
||||
Reference in New Issue
Block a user