Fixed double rulesave + fine tune the stop of the routes that caused 100 record validation not to end.
This commit is contained in:
parent
88bd430801
commit
0d363085b6
|
@ -15,7 +15,6 @@ import org.apache.camel.Exchange;
|
||||||
import org.apache.camel.Processor;
|
import org.apache.camel.Processor;
|
||||||
import org.apache.camel.TypeConversionException;
|
import org.apache.camel.TypeConversionException;
|
||||||
import org.apache.camel.builder.RouteBuilder;
|
import org.apache.camel.builder.RouteBuilder;
|
||||||
import org.apache.camel.impl.engine.DefaultShutdownStrategy;
|
|
||||||
import org.apache.http.client.ClientProtocolException;
|
import org.apache.http.client.ClientProtocolException;
|
||||||
|
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
@ -73,9 +72,8 @@ public class FairOaiPmhRoute2 extends RouteBuilder {
|
||||||
String date = new Date().toString();
|
String date = new Date().toString();
|
||||||
|
|
||||||
// Access the DefaultShutdownStrategy
|
// Access the DefaultShutdownStrategy
|
||||||
DefaultShutdownStrategy shutdownStrategy = (DefaultShutdownStrategy) getContext().getShutdownStrategy();
|
/* DefaultShutdownStrategy shutdownStrategy = (DefaultShutdownStrategy) getContext().getShutdownStrategy();
|
||||||
// Set the shutdown timeout in milliseconds (e.g., 10 seconds)
|
shutdownStrategy.setTimeout(1);*/
|
||||||
shutdownStrategy.setTimeout(1);
|
|
||||||
|
|
||||||
onException(TypeConversionException.class)
|
onException(TypeConversionException.class)
|
||||||
.process(new ExceptionProcessor(validationJob))
|
.process(new ExceptionProcessor(validationJob))
|
||||||
|
@ -126,7 +124,6 @@ public class FairOaiPmhRoute2 extends RouteBuilder {
|
||||||
.multicast().parallelProcessing()
|
.multicast().parallelProcessing()
|
||||||
.to("direct:guidelinesProcessor")
|
.to("direct:guidelinesProcessor")
|
||||||
.to("direct:fairProcessor")
|
.to("direct:fairProcessor")
|
||||||
.to("controlbus:route?routeId=1&action=stop&async=true")
|
|
||||||
.endChoice()
|
.endChoice()
|
||||||
.otherwise()
|
.otherwise()
|
||||||
.process(new ErrorProcessor(validationJob))
|
.process(new ErrorProcessor(validationJob))
|
||||||
|
@ -134,29 +131,34 @@ public class FairOaiPmhRoute2 extends RouteBuilder {
|
||||||
.endChoice()
|
.endChoice()
|
||||||
.end();
|
.end();
|
||||||
|
|
||||||
|
|
||||||
from("direct:guidelinesProcessor")
|
from("direct:guidelinesProcessor")
|
||||||
.routeId(routeid)
|
.routeId(routeid)
|
||||||
.split(xpath("//*[local-name()='record']"))
|
.split(xpath("//*[local-name()='record']"))
|
||||||
.process(new XmlProcessor(profile, validationJob, maxNumberOfRecords))
|
.process(new XmlProcessor(profile, validationJob, maxNumberOfRecords))
|
||||||
.choice()
|
.choice()
|
||||||
.when(simple("${body[results]} && ${header.MyHeader} != 'stop'"))
|
.when(simple("${body[results]} && ${header.MyHeader} != 'stop'"))
|
||||||
|
//.log("HEADER ${header.MyHeader}")
|
||||||
.split(simple("${body[results]}"))
|
.split(simple("${body[results]}"))
|
||||||
.to("jpa:" + ValidationRuleResult.class.getName() + "?usePersist=true")
|
.to("jpa:" + ValidationRuleResult.class.getName() + "?usePersist=true")
|
||||||
.endChoice()
|
.endChoice()
|
||||||
.end()
|
.end()
|
||||||
.choice()
|
.choice()
|
||||||
.when(simple("${body[issues]} && ${header.MyHeader} != 'stop'"))
|
.when(simple("${body[issues]} && ${header.MyHedddader} != 'stop'"))
|
||||||
|
//.log("HEADER ${header.MyHeader}")
|
||||||
.split(simple("${body[issues]}"))
|
.split(simple("${body[issues]}"))
|
||||||
.to("jpa:"+ ValidationIssue.class.getName()+ "?usePersist=true")
|
.to("jpa:"+ ValidationIssue.class.getName()+ "?usePersist=true")
|
||||||
.endChoice()
|
.endChoice()
|
||||||
.end()
|
.end()
|
||||||
.choice()
|
.choice()
|
||||||
.when(header("MyHeader").isEqualTo("stop"))
|
.when(header("MyHeader").isEqualTo("stop"))
|
||||||
|
//.log("HEADER ${header.MyHeader}")
|
||||||
.process(new SumUpNCleanProcessor(validationJobRepository, validationResultRepository, summaryValidationJobRepository,
|
.process(new SumUpNCleanProcessor(validationJobRepository, validationResultRepository, summaryValidationJobRepository,
|
||||||
profile))
|
profile))
|
||||||
/*.process(new DataBaseProcessor())
|
/*.process(new DataBaseProcessor())
|
||||||
.to("jpa:" + ValidationJob.class.getName() + "?useExecuteUpdate=true")//;.to("direct:saveToDatabase")*/
|
.to("jpa:" + ValidationJob.class.getName() + "?useExecuteUpdate=true")//;.to("direct:saveToDatabase")*/
|
||||||
.to("controlbus:route?routeId="+routeid+"&action=stop&async=true")
|
.to("controlbus:route?routeId="+routeid+"&action=stop&async=true")
|
||||||
|
.to("controlbus:route?routeId=1&action=stop&async=true")
|
||||||
.endChoice()
|
.endChoice()
|
||||||
.end();
|
.end();
|
||||||
|
|
||||||
|
@ -178,14 +180,21 @@ public class FairOaiPmhRoute2 extends RouteBuilder {
|
||||||
.end()
|
.end()
|
||||||
.choice()
|
.choice()
|
||||||
.when(header("MyHeader").isEqualTo("stop"))
|
.when(header("MyHeader").isEqualTo("stop"))
|
||||||
.process(new SumUpNCleanProcessor(validationJobRepository, validationResultRepository, summaryValidationJobRepository,
|
.process(new SumUpNCleanProcessor(validationJobRepository, validationResultRepository, summaryValidationJobRepository,
|
||||||
fairProfile))
|
fairProfile))
|
||||||
/*.process(new DataBaseProcessor())
|
/*.process(new DataBaseProcessor())
|
||||||
.to("jpa:" + ValidationJob.class.getName() + "?useExecuteUpdate=true")//;.to("direct:saveToDatabase")*/
|
.to("jpa:" + ValidationJob.class.getName() + "?useExecuteUpdate=true")//;.to("direct:saveToDatabase")*/
|
||||||
.to("controlbus:route?routeId="+routeid2+"&action=stop&async=true")
|
.to("controlbus:route?routeId="+routeid2+"&action=stop&async=true")
|
||||||
|
.to("controlbus:route?routeId=1&action=stop&async=true")
|
||||||
.endChoice()
|
.endChoice()
|
||||||
.end();
|
.end();
|
||||||
|
|
||||||
|
/*
|
||||||
|
from("direct:afterMulticast")
|
||||||
|
.log("All processes completed")
|
||||||
|
.to("controlbus:route?routeId=1&action=stop&async=true");
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
from("direct:saveToDatabase")
|
from("direct:saveToDatabase")
|
||||||
.routeId(routeid2)
|
.routeId(routeid2)
|
||||||
|
|
Loading…
Reference in New Issue