working project

This commit is contained in:
2021-11-18 14:35:35 +01:00
parent 3daa3abf3a
commit e941c241fc
23 changed files with 32 additions and 24 deletions

View File

@@ -60,7 +60,7 @@ public class Main {
from("activemq:queue:RawMaterial")
.enrich("direct:getPackages", new MyAggregator())
.marshal(xmlDataFormat)
.to("activemq:queue:materialPackage")
.to("activemq:queue:MaterialPackage")
.to("log:?level=INFO&showBody=true");
}

View File

@@ -8,6 +8,8 @@ import org.apache.camel.Exchange;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MyAggregator implements AggregationStrategy {
@Override
@@ -35,8 +37,23 @@ public class MyAggregator implements AggregationStrategy {
p.setDimension((String) newEx.get(i).get("dimension"));
p.setDescription((String) newEx.get(i).get("description"));
material.getPackages().add(p);
//validation
Pattern pattern = Pattern.compile("\\d\\dx\\d\\dx\\d\\d");
Matcher matcher = pattern.matcher(p.getDimension());
if(matcher.matches()){
System.out.println("maczuje");
}
else{
System.out.println("nieeeeeeeee");
}
}
Exchange result = oldExchange;
result.getIn().setBody(material);
return result;